mysql_query(): supplied argument is not a valid MySQL-Link

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tolearn
Forum Newbie
Posts: 9
Joined: Wed Nov 29, 2006 5:27 am

mysql_query(): supplied argument is not a valid MySQL-Link

Post by tolearn »

Hi,

Im trying to update some values in database and the code goes like this

$sql = "UPDATE tbl_users SET status='$sta' WHERE user_ID=$user_id";
if (!mysql_query($sql,$con))
{
die('Could not update table tbl_users: ' . mysql_error());
}

But while execueting im getting a message

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/ffinders/public_html/working_files/member_confirm_posted.php on line 286
Could not update table tbl_users:

Help me.What's wrong in this.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

Use single quotes around $user_id
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

$con is no mysql connection resource.
Do you check the return value of mysql_connect?
Post Reply