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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.