Iryk Posted April 15, 2006 Share Posted April 15, 2006 [code]<?phpinclude("db_connect.php");if($piece == "1") { $i = one; }if($piece == "2") { $i = two; }if($piece == "3") { $i = three; }if($piece == "4") { $i = four; }if($piece == "5") { $i = five; }if($piece == "6") { $i = six; }if($piece == "7") { $i = seven; }if($piece == "8") { $i =eight; }if($piece == "9") { $i = two; }if($change == "yes") { $col = $collected; $col++; $query_1 = "UPDATE $map SET Collected='$col',$i='$change' WHERE User='$user'"; mysql_query($query_1) or die("The change could not be made."); echo "You're map pieces for <b>$map</b> have been updated.";}?>[/code]That code doesn't work and I have no clue why... on this url below it gives you a map that you are allowd to change by clicking on a piece:[a href=\"http://majestic-neo.com/pet_db/maps.php?map_num=1\" target=\"_blank\"]http://majestic-neo.com/pet_db/maps.php?map_num=1[/a]This url is the url that you get for changing a piece to the image without a ? mark on it:[a href=\"http://majestic-neo.com/pet_db/update.php?map=Secret%20Laboratory%20Map&user=Iryk&piece=5&change=yes&collected=3\" target=\"_blank\"]http://majestic-neo.com/pet_db/update.php?...yes&collected=3[/a]If anyone knows why the script isn't working please help and give me a working script. Quote Link to comment Share on other sites More sharing options...
shocker-z Posted April 16, 2006 Share Posted April 16, 2006 Where are you getting the variables $collected, $change and $user from? Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted April 16, 2006 Share Posted April 16, 2006 [!--quoteo(post=365251:date=Apr 16 2006, 09:40 AM:name=shocker-z)--][div class=\'quotetop\']QUOTE(shocker-z @ Apr 16 2006, 09:40 AM) [snapback]365251[/snapback][/div][div class=\'quotemain\'][!--quotec--]Where are you getting the variables $collected, $change and $user from?[/quote]hiyou can help yourself even more just by putting in one more bit on one of your lines:[code]mysql_query($query_1) or die("The change could not be made - ".mysql_error());[/code]that will tell you what the error is as well as your 'change could not be made' message. try it and let us know what your result is. Quote Link to comment Share on other sites More sharing options...
Iryk Posted April 16, 2006 Author Share Posted April 16, 2006 The change could not be made.You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Map SET Collected='4',three='yes' WHERE User='Iryk'' at line 1That is what I got... and my variables are coming from the url after you click one of the images, w/ a ? mark, on them. Quote Link to comment Share on other sites More sharing options...
shocker-z Posted April 18, 2006 Share Posted April 18, 2006 Does the table 'Map' exists and are you sure the field names are correct? it looks like its to do with the table name as that is first bit of query shown, if it was a field problem then wouldn't normaly show table name... if table map exists make sure it starts with a capital like in your query :)RegardsLiam 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.