I have this script that displays reviews in a fashion that i want, it displays them like
A
title
title
B
C
etc.
<?
$alpha = range('A','Z');
$ptrAlpha = 0;
$db = mysql_pconnect("localhost", "mike", "c00l");
if (!$db)
{
echo "<b>Could not connect to database, try again later.</b>";
exit;
}
mysql_select_db("news");
$sql = "SELECT title FROM reviews ORDER BY title";
$result = mysql_query($sql, $db);
$thisAlpha = $alpha[$ptrAlpha];
while (list($title) = mysql_fetch_array($result))
{
// If the current letter is lower than the current name
// loop until it's either not, or we run out of letters.
while (($thisAlpha < $title) && ($ptrAlpha < count($alpha))) {
print "<center><h2><u><b>$thisAlpha</b></u></h2>\n";
$ptrAlpha++;
$thisAlpha = $alpha[$ptrAlpha];
}
// Ok, now print out the current database record
print "<a href=\"reviewdis.php?id=$id\">$title</a><br>\n";
}
// Print out the rest of the Alphas if any are left.
for($ptrAlpha;$ptrAlpha < count($alpha); $ptrAlpha++) print "<h2><u><b>$alpha[$ptrAlpha]</h2></u></b>\n";
?>
Now, i want to link to the title, so i do
print "<a href=\"reviewdis.php?id=$id\">$title</a><br>\n";
That doesnt work because it says id is undefined, so how do i define id, (id is the primary key in my table called reviews that was auto_increcment on it) thanks alot,
Mike