Ok, have a mysql database which has some information about software reviews (which users have inputed via a form).
I've got two scripts which show a list of links (links.php) and then from the links a variable is passed called id - the id holds the contents of the links. This id var is passed to showlinks.php which is meant to call up all the fields in the clicked row (making sense, or lost yet?)
The main part of links.php looks like this:
$result = mysql_query("SELECT date FROM review");
$num_rows = mysql_num_rows ($result);
print "<table border=0>\n";
while ($a_row = mysql_fetch_row($result))
{
print "<tr>\n";
foreach ($a_row as $field)
print "\t<td>" ?>
<? print"<a href=http://www.phpbuilder.com/board/archive/index.php/\"showlinks.php?id=$a_row[0]\">$field</a>";?>
<? print "</td>\n"; ?>
<?print "</tr>\n";
}
print "</table>\n";
---------------------------------------------
which works fine, then showlinks.php is mainly this:
<? $result = mysql_query ("SELECT * WHERE date=id");
print "<table border=1>\n";
print $result;
while ($a_row = mysql_fetch_row($result))
{
print "<tr>\n";
foreach ($a_row as $field )
print "\t<td>$field</td>\n";
print "</tr>\n";
}
print "</table>\n";
mysql_close($link);
?>
---------------------------------------------
The error
(Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\ltphp\showlinks.php on line 32)
seems to come from the mysql_fetch_row, which is driven by $result, which in turn is created from the mysql_query - can anyone see any problems with this, which would produce these errors?
The only one that I can think of is the fact that id has a space in it, but that shouldn't stop it?
Any ideas?
Thanks in advance
I've got two scripts which show a list of links (links.php) and then from the links a variable is passed called id - the id holds the contents of the links. This id var is passed to showlinks.php which is meant to call up all the fields in the clicked row (making sense, or lost yet?)
The main part of links.php looks like this:
$result = mysql_query("SELECT date FROM review");
$num_rows = mysql_num_rows ($result);
print "<table border=0>\n";
while ($a_row = mysql_fetch_row($result))
{
print "<tr>\n";
foreach ($a_row as $field)
print "\t<td>" ?>
<? print"<a href=http://www.phpbuilder.com/board/archive/index.php/\"showlinks.php?id=$a_row[0]\">$field</a>";?>
<? print "</td>\n"; ?>
<?print "</tr>\n";
}
print "</table>\n";
---------------------------------------------
which works fine, then showlinks.php is mainly this:
<? $result = mysql_query ("SELECT * WHERE date=id");
print "<table border=1>\n";
print $result;
while ($a_row = mysql_fetch_row($result))
{
print "<tr>\n";
foreach ($a_row as $field )
print "\t<td>$field</td>\n";
print "</tr>\n";
}
print "</table>\n";
mysql_close($link);
?>
---------------------------------------------
The error
(Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\ltphp\showlinks.php on line 32)
seems to come from the mysql_fetch_row, which is driven by $result, which in turn is created from the mysql_query - can anyone see any problems with this, which would produce these errors?
The only one that I can think of is the fact that id has a space in it, but that shouldn't stop it?
Any ideas?
Thanks in advance