knowj
12-28-2005, 10:54 AM
how would i go about making this sql/php script loop to show all results in the database? the loop isnt the problem with me its that im using an include and echoing on my index.php page so i cant echo each variable within the loop in the script
im just assigning everything to the variable $diary to be echoed on the index.php page
$query = 'SELECT * FROM diary ORDER BY diary_no DESC';
$result = mysql_query($query, $link);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$diary .= <<<DIARY
<!-- beginning of text left -->
<h1>Latest Diary Entry:</h1>
<p>{$row['diary_date']}</p>
<p>{$row['diary_text']}</p>
DIARY;
thanks in advance
im just assigning everything to the variable $diary to be echoed on the index.php page
$query = 'SELECT * FROM diary ORDER BY diary_no DESC';
$result = mysql_query($query, $link);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$diary .= <<<DIARY
<!-- beginning of text left -->
<h1>Latest Diary Entry:</h1>
<p>{$row['diary_date']}</p>
<p>{$row['diary_text']}</p>
DIARY;
thanks in advance