mr.web_developer Posted April 17, 2011 Share Posted April 17, 2011 Hi all Good morning / night / afternoon I have a problem I will describe it in detailes I have a database that contain a table called request. It contains 3 names as you can see in the pic I would like to print all thoes names in a way we will see it later let's take a look at the php file [code=php:0] <?php $e = mysql_query("select Requster_Name from request"); while ($row = mysql_fetch_array($e)) { extract($row); $RN = $row [‘Requster_Name’]; print $easy->display("TEMPLATE.tpl"); } ?> [/code] as you can see I'm using template engine print $easy->display("TEMPLATE.tpl"); It will print all the names bu passing it to the template ((template code)) <div id="content" align="center"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;width:333px"> <tr height="25" style="height:18.75pt"> <td style="width: 329px; font-size: 14.0pt; font-weight: 700; text-align: center; color: black; font-style: normal; text-decoration: none; font-family: Calibri, sans-serif; vertical-align: bottom; white-space: nowrap; border-left: medium none; border-right: 1.5pt solid black; border-top: .5pt solid windowtext; border-bottom: .5pt solid windowtext; padding-left: 1px; padding-right: 1px; padding-top: 1px; background: #C5D9F1"> {RN}</td> </tr> </table> </div> It will print the names like this as you can see I'm using the template engine print function inside the while loop but I want to use it outside the loop for a reason when I take it out the loop <?php $e = mysql_query("select Requster_Name from request"); while ($row = mysql_fetch_array($e)) { extract($row); $RN = $row [‘Requster_Name’]; } print $easy->display("TEMPLATE.tpl"); ?> It will only print Cris I hope it's clear what I want is to print all the names when the print function outside the loop I want it be print in one record like this thank you Quote Link to comment Share on other sites More sharing options...
dreamwest Posted April 17, 2011 Share Posted April 17, 2011 *blank Quote Link to comment Share on other sites More sharing options...
dreamwest Posted April 17, 2011 Share Posted April 17, 2011 Is this smarty templates?? Normally you would store the data as an array then assign it PHP: $e = mysql_query("select Requster_Name from request"); while ($row = mysql_fetch_assoc($e)) { //extract($row); $RN[] = $row[‘Requster_Name’]; } $easy->assign("RN", $RN); $easy->display("TEMPLATE.tpl"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.