Page 1 of 1

printef

Posted: Tue Jul 10, 2012 11:03 am
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?

Re: printef

Posted: Tue Jul 10, 2012 11:23 am
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";
  }