php - My sql Error 1054 -
i need update my authkey random string in ssodemo table. stuck following error.
here code..
$randomkey = $this->generaterandomstring(); //generates random string $sql = "update ssodemo set authkey=$randomkey authkey=$authkey"; if(mysqli_query($con,$sql)) echo "updated successfully...."; else { echo "not updated..."; echo mysqli_errno($con)." ".mysqli_error($con); }
i getting following error ...
not updated...1054unknown column 'szfuaenwsf' in 'field list'
i cannot find query wrong
but when change query as
$sql = "update ssodemo set authkey='$randomkey' authkey='$authkey'";
i following error
not updated...1064you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'tdsbeuhgxt''' @ line 1
atlast , when change query as
$sql = "update ssodemo set authkey='$randomkey' authkey=$authkey";
i correct result .. can expailn this?
you have put values in single quotes. without quotes, mysql considering value of $randomkey
name of column , trying assign value of column authkey
column.
$sql = "update ssodemo set authkey='$randomkey' authkey='$authkey'";
hope fix error.
Comments
Post a Comment