printef

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

Post Reply
zura
Forum Newbie
Posts: 9
Joined: Mon Oct 17, 2011 1:04 am

printef

Post by zura »

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?
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Re: printef

Post by Stoker »

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";
  }
Post Reply