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-Link

Status
Not open for further replies.

mancroft

Programmer
Oct 26, 2002
267
GB
I am trying to get php to send an email part of which is a display of a MySQL table.

The code below may or may not be correct but I am getting the error message:

Warning: Supplied argument is not a valid MySQL-Link resource in /home/mancroft/ on line 32

plus two similar messages for other lines.

Any ideas please?

MYSQL_CONNECT(localhost, mancroft, xxxxxx) OR DIE("Unable to connect");

mysql_select_db("mancroft_test",$db);

$result = mysql_query("SELECT * FROM cart",$db);
if ($result === false) die("failed");

while ($row=mysql_fetch_row($result)) {
$RBI=$row[0];
$RUI=$row[1];
$RON=$row[2];
}

$serveroutput = "$RBI $RUI $RON";
 
You're getting that error because you are supplying an optional resourse-link identifier in the form of a value in $db, when you haven't initialized $db.

Either change your database connection line to read:

$db = mysql_connect (.....)

or drop the optional parameter in mysql_query():

$result = mysql_query("SELECT * FROM cart");


Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top