Page 1 of 1

Retrieve information from a database?

Posted: Fri Jul 12, 2002 6:53 pm
by EthanX
Hello, I'm kinda new to php and I'm trying to retrieve information from my database. but when I do I get this error:
Warning: Supplied argument is not a valid MySQL result resource in /usr/local/psa/home/vhosts/domain.com/httpdocs/mysqlinfo.php on line 11

Here's my code, can you tell me what is wrong? Thank you.

Code: Select all

<?php

$linkID = mysql_connect("localhost", "username", "passwprd");
mysql_select_db("dbname", $linkID);

$resultID = mysql_query("SELECT * FROM customer", $linkID);

print "<table border=1><tr><th>Customer ID</th>";
print "<th>First Name</th><th>Last Name</th></tr>";

while ($row = mysql_fetch_row($resultID))
&#123;
	print "<tr>";
	foreach ($row as $field)
	&#123;
		print "<td>$field</td>";
	&#125;
	print "</tr>";
&#125;

print "</table>";

mysql_close($linkID);

?>

Posted: Fri Jul 12, 2002 8:15 pm
by EthanX
UPDATE:

Never mind now, I added or die(mysql_error()); to my select db and I found out I was typing the an non-existance database :roll: :lol:
I feel so stupid... :oops: