Retrieve information from a database?
Posted: Fri Jul 12, 2002 6:53 pm
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.
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))
{
print "<tr>";
foreach ($row as $field)
{
print "<td>$field</td>";
}
print "</tr>";
}
print "</table>";
mysql_close($linkID);
?>