Jump to content

[SOLVED] MySQL error, I can't figure it out....


jumpenjuhosaphat

Recommended Posts

I'm getting this error:

 

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/homeswap/public_html/admin_profile.php on line 97

 

This is the output of my query:

 

UPDATE user SET password='########' , first='David' , last='Davis' , address='#### Gull St.' , town='####' , county='#####' , postarea='ZE3' , postcode='ZE3 J83L' , phone='###-###-5868' , email='jumpenjuhosaphat@####.com' WHERE username='jumpenjuhosaphat'

 

I hashed out the personal stuff for obvious reasons.

 

Here is the code, can you spot any troubles?

 

            $sql=sprintf("UPDATE user SET 
            password='%s' , first='%s' , last='%s' , address='%s' , 
            town='%s' , county='%s' , postarea='%s' , 
            postcode='%s' , phone='%s' , email='%s' WHERE username='%s'",
            $pass1, $first, $last, $address, $town, $county,
            $postarea, $postcode, $phone, $email, $username);

            if(!mysql_query($sql, $con))
              {
                die($sql.mysql_error());
              }

Link to comment
https://forums.phpfreaks.com/topic/45556-solved-mysql-error-i-cant-figure-it-out/
Share on other sites

This seems to be how it works everytime.  I search and search the internet for a solution, and search and search my code to try to find the problem.  Then as a last resort, I bring the trouble here.....

 

As soon as I do that, I figure it out....The problem was in this line:

 

if(!mysql_query($sql, $con))

 

I took out the $con variable, and now it works fine....

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.