Jump to content

[SOLVED] Return more rows


Imtehbegginer

Recommended Posts

<?php

 

include('includes/config.php');

 

$connect = mysql_connect($config['host'], $config['user'], $config['pass']);

$database = mysql_select_db($config['name']);

 

$query = mysql_query("SELECT * FROM rosecms_news");

 

$news = mysql_fetch_array($query);

 

echo '<H1>'.$news['title'].'</h1>';

echo $news['date'];

echo '<BR>';

echo '<BR>';

echo $news['content'];

?>

 

That is my code above... how can I return the next set of data?

 

If I re-do the script, it returns the exact same data.

Link to comment
https://forums.phpfreaks.com/topic/71732-solved-return-more-rows/
Share on other sites

while($news = mysql_fetch_array($query)){
echo '<H1>'.$news['title'].'</h1>';
echo $news['date'];
echo '<BR>';
echo '<BR>';
echo $news['content'];
echo "<br><br>\n";
}

 

in replace of:

 

$news = mysql_fetch_array($query);

echo '<H1>'.$news['title'].'</h1>';
echo $news['date'];
echo '<BR>';
echo '<BR>';
echo $news['content'];

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.