mysql php handling no data after select -


i know how handle no data or error code 1329 after executing query.

$stmt = $this->db->prepare('select username users device_id=?'); $stmt->bind_param("s", $device_id); $flag = $stmt->execute(); $stmt->bind_result($username); 

i'm expecting code come through since executes, flag true.

i suggest doing this:

$stmt = $this->db->prepare('select username users device_id=?'); $stmt->bind_param("s", $device_id); $stmt->execute(); $stmt->bind_result($username); if($stmt->fetch()) {     echo "found $username"; } else {     echo "did not find user"; } $stmt->close(); 

Comments

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -