Hey. I need some help with getting a record from a mysql database and compare it with data already stored in a php variable. If they don't match then I want to save the record in the database under another field and then update it. Here is my code:
$query = "SELECT * FROM players WHERE UID='$uid';
$result=mysql_query($query);
$count=mysql_num_rows($result);
if($count==1){
$row = mysql_fetch_array($result) or die(mysql_error());
if($nick!={$row['Nick']})
{
mysql_query("UPDATE players SET NickOld = {$row['Nick']} AND Nick = '$nick' WHERE UID = '$uid'");
}
So what I do is check if $nick is equal to the data stored in the field namned Nick in database. If not I want to save that record to another field namned NickOld and then set the Nick field to the new data. But I get the error "unexpected T_STRING" on this line
mysql_query("UPDATE players SET NickOld = {$row['Nick']} AND Nick = '$nick' WHERE UID = '$uid'");
So, is it merely a syntax error? Or am I approaching it the wrong way?