Steve Angelis Posted February 9, 2008 Share Posted February 9, 2008 <?php $username=$_POST['username']; $activate=$_POST['activate']; require('../inc/config.php'); $linkid = @mysql_connect("$db_host", "$db_uname", "$db_pass"); mysql_select_db("$db_name", $linkid); $result=mysql_query("SELECT activate FROM nxg_tempmbr WHERE username='$username'") or die("$query does not make any sence;<br>" . mysql_error()); if (mysql_num_rows($result)==0){ echo "No such user exists."; } else{ $result=mysql_fetch_array($result); if ($activate == $result[0]){ $result2=mysql_query("SELECT * FROM nxg_tempmbr WHERE username='$username'") or die("$query does not make any sence;<br>" . mysql_error()); $result2=mysql_fetch_array($result2); $username1=$result2['username']; $password=md5($result2['password']); $empire_name=$result2['empire_name']; $ruler_name=$result2['ruler_name']; $email=$result2['email']; $race_id=$result2['race_id']; $description=$result2['description']; $q = "INSERT INTO nxg_member (id, username, password, empire_name, ruler_name, email, race, description) values ('NULL', '$username1', '$password', '$empire_name', '$ruler_name', '$email', '$race_id', '$description')"; mysql_query($q) or die("$q does not make any sense;<br>" . mysql_error()); mysql_query("delete from nxg_tempmbr where $username='username'"); } else{ echo 'ERROR--Does '.$result[0].' = '.$activate.'?<br>'; } } ?> Now here is the problem. mysql_query("delete from nxg_tempmbr where $username='username'"); I get this error which does not make sence.: INSERT INTO nxg_member (id, username, password, empire_name, ruler_name, email, race, description) values ('NULL', 'steve1', '6f1ed002ab5595859014ebf0951522d9', 'empire', 'ruler', 'steveangelis@neraxia.com', '', 'yayayaya') does not make any sense; Unknown column 'steve1' in 'where clause' If I remove the delete line I get no error and it works. Even though I get this error it still enters itsself into my database. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted February 9, 2008 Share Posted February 9, 2008 You keep using $query in die(), but it has never been set. Exactly which line is the problem? Quote Link to comment Share on other sites More sharing options...
Steve Angelis Posted February 10, 2008 Author Share Posted February 10, 2008 The error comes with the delete from the database. Without that bit there there are no errors. With it it causes the above error and does n ot work. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted February 10, 2008 Share Posted February 10, 2008 It needs to be mysql_query("delete from nxg_tempmbr where 'username'='$username'"); Note: Make sure that $username is secure using a function like mysql_real_escape_string(). That goes for all the queries. Quote Link to comment Share on other sites More sharing options...
Steve Angelis Posted February 11, 2008 Author Share Posted February 11, 2008 Ok now I feel just stupid lol 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.