Jump to content

What am I doing wrong here?


alexville

Recommended Posts

Hello,

I am getting an error when I try to run this query:
[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>Chnage your account on dsfdsfsfsfs Game</title>
<style type="text/css">
<!--
body {
    background-color: #CCCCCC;
}
.style1 {font-family: Tahoma}
-->
</style></head>

<body>
<?php
// Get the 'username' varible from flash
$username = $_POST['username'];
$password = $_POST['password'];
$clueone = $_POST['clueone'];
$cluetwo = $_POST['cluetwo'];
$cluethree = $_POST['cluethree'];

$dbcnx = @mysql_connect("localhost","fdsfdsfs","dsfsfsfs");
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', Cluetwo = '$cluetwo', Cluethree = '$cluethree' WHERE Username = '$username', Password = '$password'");
if (!$result) {
exit("<p>Error performing query: " . mysql_error() . "</p>");
}
?>
<p><a href="http://dsfsfsfsfs" class="style1">Click here to login </a></p>
</body>
</html>[/code]

This error is what I get:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Error performing query: 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 ' Password = ''' at line 1[/quote]

What am i'm doing wrong?

Mysql version = 4.1.14-standard
Link to comment
Share on other sites

I would recommend you to put back ticks around the word Password in your mysql query as password a predefined function in mysql and so m ysql is getting confused so if you add back ticks around it then your query should pass through:
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][color=green]WHERE[/color] Username[color=orange]=[/color][color=red]'$username'[/color] [color=blue]AND[/color] `Password`[color=orange]=[/color][color=red]'$password'[/color]" [!--sql2--][/div][!--sql3--]
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.