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 - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -