PDA

View Full Version : sql problem :(



GregT
November 7th, 2002, 18:18
this is my first big thing in sql, i usaully do stuff flat file but sql works better here.



function adminreg() {
if(!($link_id = mysql_connect("mysqlserver", "yupadog", "pass"))) die(mysql_erorr());
mysql_select_db(yupadog);


$sql = "INSERT INTO " . $Table . " VALUES('', '" . addslashes($_POST['Name']) . "', '" . md5($_POST['Password']) . "')";
if(!($result = mysql_query($sql))) {
die(mysql_error());
} else {

echo "Your user account has been created!<br>";
echo "<a href=index.php>Continues</a> to the login page";
}
}

What wrong with my sql ? I get "You have an error in your SQL syntax near 'VALUES('', 'raz0r', '5f4dcc3b5aa765d61d8327deb882cf99')' at line 1"
plz help :(

biggulp
November 7th, 2002, 20:31
add
global $_POST;

after function adminreg()

also edit this: mysql_select_db("yupadog");

GregT
November 7th, 2002, 21:13
Originally posted by biggulp
add
global $_POST;

after function adminreg()

also edit this: mysql_select_db("yupadog");

its not any of that stuff, as the information is being passed. :(

biggulp
November 7th, 2002, 23:27
INSERT INTO " . $Table . "(name, password) VALUES('{$_POST['name']}','{$_POST['password']}')