weird problem with mysqli
Posted: Thu Aug 06, 2009 12:33 am
I have this piece of code:
So here's the problem, query itself is correct as far as i know, i ran it in both phpmyadmin and cmd (running windows) and it returns what it's supposed to return. But here $body is always empty. It's as if bind_result() isn't passing retrieved data to the variable. No errors/warnings are generated.
Spent all night going through the variables, looking for typo's, var_dump'ing everything, even rewrote the whole thing from scratch. Desperately need help :/
Code: Select all
public function getEntry($uniqId,$pageNo){
$mysqli=kjrDB::dbStart();
$qry="SELECT entries.title,entries.body FROM entries JOIN details ON details.id=entries.id WHERE details.uniqID=? AND entries.page=?";
if($stmt=$mysqli->prepare($qry)){
$stmt->bind_param('si',$uniqId,$pageNo);
$stmt->execute();
$stmt->bind_result($title,$body);
$stmt->fetch();
$stmt->close();
return array('title'=>$title,'body'=>$body);
}else{
trigger_error('Could Not Prepare Query',E_USER_WARNING);
return false;
}
}