FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Looping & echo ini Php with out using while or for





Philip
Is there someone know how to programing php for printing output from mysql_fetch_array() with out using while or for ?

i mean like this, ussualy i will using like this

while ($row=mysql_fetch_array($query))
{
echo "<table><tr>";
echo "<td>".$row[0]."</td>";
echo "<td>".$row[1]."</td>";
echo "<td>".$row[2]."</td>";
echo "</tr></table>";
}

but it seem there's other way with out using Php like using this

<table>
<List:ITEM>
<tr>
<td>{name}</td>
<td>{address}</td>
<td>{phone}</td>
</tr>
</List:ITEM>
</table>

please some explain it to me ?
thanks, Embarassed
Philip
<up this topic to top>
how to make the listing of recordset with out using looping ?
do some one know ?
thanks,
i alreadied search at google but it seem i missed it. Embarassed
n0obie4life
Phillip, the second way is a templating engine if I'm not mistaken. Obviously it still uses PHP to parse variables to the template side..

The first and second way are the same actually Rolling Eyes.
raver
yes, those are just signs for the template sistem to replace those with what it should show instead. Imagine you are implementing a two language website.
Switching after the users selection, and using str_replace the template engine turns {ONEWORD} in THE RIGHT WORD.
And you can't do what you asked without a while or a for loop. Rolling Eyes
Philip
then, how can i make a {variable} <-- like this one ?
also make it as array {variable} ..

thanks.
Related topics
Tutorial: PHP Installed Modules Dynamic Reference Tool
PHP Tutorials
[*READ THIS FIRST!*] Commonly asked questions
.htaccess problem
[Dúvidas] Pontos
Some php probs..need some help plzz!
php/HTML pages question
php coding needed
Some times, the error is so hard to find and so funny
footer.php date wrong
PHP using Sessions
Frame Effect Without Frames! (PHP)
PHP page turning problem
python programming
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.