|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
MaaSTaaR Smarty Rookie
Joined: 08 Oct 2004 Posts: 8
|
Posted: Wed Jan 19, 2005 3:42 am Post subject: mysql_num_rows() with Smarty |
|
|
Hello ..
how i can make like this code with smarty ?
[php:1:447083bc6c]<?php
$query = mysql_query("SELECT * FROM table");
while ($row = mysql_fetch_array($query)) {
echo "section title : " . $row['title'] . " news number : " . mysql_num_rows($query);
}
?>[/php:1:447083bc6c]
thanks |
|
Back to top |
|
michaelphipps Smarty Regular
Joined: 13 Sep 2004 Posts: 45 Location: Brisbane
|
Posted: Sat Feb 19, 2005 7:32 am Post subject: |
|
|
Quote: | <?php
$query = mysql_query("SELECT * FROM table");
while ($row = mysql_fetch_array($query)) {
echo "section title : " . $row['title'] . " news number : " . mysql_num_rows($query);
}
?> |
Not sure what you are trying to do.
Could you read your code again and check if you missed something?
Can you give an example of the information you want to output? _________________ Michael Phipps
Internet Geek Extrodinaire
http://www.michaelphipps.com |
|
Back to top |
|
MaaSTaaR Smarty Rookie
Joined: 08 Oct 2004 Posts: 8
|
Posted: Sat May 21, 2005 9:36 pm Post subject: |
|
|
ok , when i want get info from db i will use {section} .
for example :
php :
[php:1:57db96ea3f]
<?
$getinfo = mysql_query("SELECT * FROM table");
while ($row = mysql_fetch_array($getinfo)) {
$rows[] = $row;
$Smarty->assign("rows",$rows);
}
?>
[/php:1:57db96ea3f]
HTML & Smarty :
Code: |
{section name=idx loop=$rows}
name : {$rows[idx].name}
<!-- etc ... -->
{/section}
|
now .. for example i want to get table records number i will use mysql function -> mysql_num_rows();
how i can print mysqn_num_rows() returns in HTML code ? |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|