Hey guys I am using the folloiwng code in order to delete a user and then delete data from another table which is related by the username field.
<?php
$q = "select Username from `table` where UserID = '$_POST['userid'];
$result = mysql_query($q) or die(mysql_error());
if(mysql_num_rows($result)){
$row = mysql_fetch_array($result);
$q2 = "Delete from `table2` WHERE Username = {$row['username']}";
$result2 = mysql_query($q2) or die(mysql_error());
?>
But then I get the the following error where jess is an actual username. Anyi deas why this is happening?
Unknown column 'jess' in 'where clause'