alexville Posted March 26, 2006 Share Posted March 26, 2006 Hello,I am making a PHP game and I need help with updating the "user"'s account infomation the database.I have 2 pages at the moment. One of them contains the form. The other contains the PHP code. Heres the PHP code:[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Who Am I? Game - Assikinack Edition</title><style type="text/css"><!--body { background-color: #CCCCCC;}body,td,th { color: #000000; font-family: Arial, Helvetica, sans-serif;}.style1 {font-family: "Courier New", Courier, mono}--></style></head><body><h1>Who Am I? Game</h1><?php$username = $_POST['username'];$password = $_POST['password'];$clueone = $_POST['clueone'];$cluetwo = $_POST['cluetwo'];$cluethree = $_POST['cluethree'];// *End* ~Get the 'username' varible from flash~// Disply my famous welcome messageecho "Updating Your Account Info...";// *End* ~Disply my famous welcome message// End PHP code for now and create HTML divider// Start database connection$dbcnx = @mysql_connect("localhost","username","password");if (!$dbcnx) {echo "<p>Unable to connect to the database server at this time.</p>";exit();}mysql_select_db("alexg_web",$dbcnx);$result = @mysql_query("UPDATE whoamipeople SET Clue='$clueone' AND Cluetwo='$cluetwo' AND Cluethree='cluethree' WHERE Username = '$username' AND Password = '$password'");if (!$result) {exit("<p>Sorry, There must be a problem with your Username or Password. Please press back on your browser and retype the infomation. Here is the mysql error: " . mysql_error() . "</p>");} else {echo "<p> Your Infomation Has Been Updated! </p>"// swich back to html mode to create divider?><p>S<a href="http://www.whoami.alexville.com/game.htm">ign-Out</a></p><hr></html>[/code]I think I have a problem with the UPDATE function. Please help me. Link to comment https://forums.phpfreaks.com/topic/5847-updateing-infomation-in-the-database/ Share on other sites More sharing options...
toplay Posted March 26, 2006 Share Posted March 26, 2006 Replace the 'AND' with commas. See update syntax in manual:[a href=\"http://dev.mysql.com/doc/refman/4.1/en/update.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/4.1/en/update.html[/a] Link to comment https://forums.phpfreaks.com/topic/5847-updateing-infomation-in-the-database/#findComment-20840 Share on other sites More sharing options...
alexville Posted March 26, 2006 Author Share Posted March 26, 2006 UPDATE [LOW_PRIORITY] [IGNORE] tbl_name SET col_name1=expr1 [, col_name2=expr2 ...] [WHERE where_condition] [ORDER BY ...] [LIMIT row_count]I just want to use data collected from a form. Does anyone have an example i could use? Link to comment https://forums.phpfreaks.com/topic/5847-updateing-infomation-in-the-database/#findComment-20968 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.