Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Supplied argument is not a valid MySQL result resource

Status
Not open for further replies.

mancroft

Programmer
Oct 26, 2002
267
GB
Hello

i am new to mysql and am setting up a tagboard that i got from:



when i run it, i get an error:

Warning: Supplied argument is not a valid MySQL result resource in /home/mancroft/john/tagboard/view.php on line 15

the file view.php is:

<?php

#change localhost to the sql server, user to the correct username, and pass to the correct password
$con = mysql_connect(&quot;localhost&quot;,&quot;mancroft&quot;,&quot;csHah3W&quot;) or die(&quot;Unable to establish a connection to the database.&quot;);

#change database to the database name
$database = &quot;mancroft_tagboard&quot;;
$db = mysql_select_db(&quot;$database&quot;) or die(&quot;Couldn't select database $database.&quot;);

$query = &quot;SELECT id,name,http,msg FROM tagboard ORDER BY id DESC&quot;;
#selects all the rows from the table tagboard and orders them in descending order

$result = mysql_query($query);

while ($rows = mysql_fetch_row($result))
{
echo &quot;<a href='$row[http]' target='_blank'>$row[name]</a>: $row[msg]<br>&quot;;
}

?>

Any idea what is wrong?

TIA
 
First, NEVER, EVER post your real username and password.
Second, try changing
Code:
$result = mysql_query($query);
to
Code:
$result = mysql_query($query) or die(&quot;Unable to query: &quot; . mysql_error());
//Daniel
 
1. it isn't my real password! i'd spotted that before.

2. the line generates the following error:

Table 'mancroft_tagboard.tagboard' doesn't exist

Thanks for your help.
 
That means that you haven't created the table yet. You would have to create the table with a query like this:
Code:
CREATE TABLE tagboard(
column1 ....
);
//Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top