why this simple database operation does not work
function AddToUsersTable($mail,$nick,$pw) // $mail is an email add
{
$db = new mysqli("localhost","root","","mydb");
if($db){
$mail = $db->real_escape_string($mail);
//print($mail . "</br>");
$nick = $db->real_escape_string($nick);
$pw = $db->real_escape_string($pw);
$q = $db->query("INSERT INTO users (nick, email, pw) VALUES($nick, $mail, $pw);");
if($q)
return true;
else{ /* it fails here *;
print($db->error);
return false;
}
}
else{
print("failed to connect to db </br>");
return false;
}
}
// thanks in advance