PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
zura
Forum Newbie
Posts: 9 Joined: Mon Oct 17, 2011 1:04 am
Post
by zura » Tue Jul 10, 2012 11:03 am
Hi.
Is possible to include php file inside printf ?
Thank you for help.
Code: Select all
<?php $result = mysql_query("SELECT * FROM base WHERE id='$id' ",$db1);
}
if (mysql_num_rows($result) > 0) {
$myrow = mysql_fetch_array($result);
do {
printf("
<table>
<tr>
<td>
<p>%s</p>
</td>
<td>
<p><?php include ('phpfile.php');?></p>
</td>
</tr>
</table>",$myrow["text"]);
}
while ($myrow = mysql_fetch_array($result));
}
?>
How write this script correctly?
Stoker
Forum Regular
Posts: 782 Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:
Post
by Stoker » Tue Jul 10, 2012 11:23 am
not sure about printf - but why not just break it up and use multiple lines?
Code: Select all
while ($row = mysql_fetch_assoc($qr))
{
echo "some stuff " . htmlspecialchar($somevar) . " more stuff";
include ('file');
echo "yet more stuff";
}