MySQLi Prepared Statement not returning any results

时间:2016-10-20 12:57:59

标签: php mysqli prepared-statement

I'm very new to PHP and MySQL, and I'm having trouble performing a prepared statement.

This query returns data exactly as I expect it to:

$result = $con->query('SELECT * FROM users WHERE email="' . $user->user_email . '" LIMIT 1');

However, when forming the query into a prepared statement,

$stmt = $con->prepare('SELECT * FROM users WHERE email=? LIMIT 1');
$stmt->bind_param('s', $user->user_email);
$result = $stmt->execute();

I get no results every time. Is there something wrong with the way I'm preparing the statement?

0 个答案:

没有答案