Jump to content

Updateing Infomation In the Database


alexville

Recommended Posts

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 message
echo "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
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.