Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

mysql_num_rows() with Smarty

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
MaaSTaaR
Smarty Rookie


Joined: 08 Oct 2004
Posts: 8

PostPosted: Wed Jan 19, 2005 3:42 am    Post subject: mysql_num_rows() with Smarty Reply with quote

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 Smile
Back to top
View user's profile Send private message
michaelphipps
Smarty Regular


Joined: 13 Sep 2004
Posts: 45
Location: Brisbane

PostPosted: Sat Feb 19, 2005 7:32 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
MaaSTaaR
Smarty Rookie


Joined: 08 Oct 2004
Posts: 8

PostPosted: Sat May 21, 2005 9:36 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP