Jump to content

Deleting and inserting


Steve Angelis

Recommended Posts

<?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', '[email protected]', '', '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.

Link to comment
https://forums.phpfreaks.com/topic/90257-deleting-and-inserting/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.