Jump to content

[SOLVED] Repeating a loop


Andrew R

Recommended Posts

I have the following query…

 

$query_news = "SELECT * FROM news";

$news = mysql_query($query_news, $conn_aasv) or die(mysql_error());

$row_news = mysql_fetch_assoc($news);

$totalRows_news = mysql_num_rows($news);

 

do {

 

echo $row_news[‘title’];

 

} while ($row_news = mysql_fetch_assoc($news));

 

How would I reuse/repeat the above loop so I could use it on different parts of my pages, instead of having to write a new query for every one? Would I use mysql_data_seek somewhere in the script above?

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/135825-solved-repeating-a-loop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.