Jackthumper Posted September 29, 2010 Share Posted September 29, 2010 if (($update_avatar1 == 'http://images.toxicpets.co.cc/vPets/Acara11.gif') OR ($update_avatar1 == 'http://images.toxicpets.co.cc/vPets/Aisha5.gif')) { mysql_query("UPDATE avatar SET avatar = '$update_avatar1' WHERE username = '$username' AND game = '$game'") or die ("Database error: ".mysql_error()); mysql_query("INSERT INTO avatar ($update_avatar1 WHERE id = '$userid')"); This is an avatar System But It Is Not Inserting Into The Database Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted September 29, 2010 Share Posted September 29, 2010 UPDATE avatar SET avatar Your table and field names are the same? Quote Link to comment Share on other sites More sharing options...
Jackthumper Posted September 29, 2010 Author Share Posted September 29, 2010 This Is The Database Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted September 29, 2010 Share Posted September 29, 2010 The first query should work as long as all the variables have the proper values. Have you echoed the query string to make sure? The second query is using improper syntax. Quote Link to comment Share on other sites More sharing options...
Jackthumper Posted September 29, 2010 Author Share Posted September 29, 2010 The Second Query Was Wrong But How Will It Insert If There Is No Table To Update??? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted September 29, 2010 Share Posted September 29, 2010 What do you mean? Can you explain exactly what it is you want that code to do, please? Quote Link to comment Share on other sites More sharing options...
Jackthumper Posted September 29, 2010 Author Share Posted September 29, 2010 I want it to update but if the user has no table in the database i want it to create one with there userid ,username and game which is '1' Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted September 29, 2010 Share Posted September 29, 2010 Have a read through INSERT . . . ON DUPLICATE KEY UPDATE syntax, and see if that sounds like what you need. Quote Link to comment Share on other sites More sharing options...
Jackthumper Posted September 29, 2010 Author Share Posted September 29, 2010 I don't Get That it has (a,b,c) VALUES (1,2,3) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.