I am trying to move some code to php5 & mysqli objects and I am running into a problem with getting a row in an associative array.
The keys to not seem to be coming over correctly. I have included the code I am using and the var_dump() of one of the rows I get back from the $result->fetch_assoc() line.
PHP Code:
$query = "SELECT * FROM news WHERE Topic LIKE '$topic' ORDER BY Date DESC" ;
$result = $this->mysqli->query($query);
$returned_ID = array();
while ( $row = $result->fetch_assoc() ) {
var_dump($row);
$returned_ID[] = $row['ID'];
}// end while rows returned
return $returned_ID;
var_dump result - (this is a news story I am pulling from the database with fields ID, date, category, title, and body)
array(5) { ["B"]=> string(2) "51" ["鈧
The keys to not seem to be coming over correctly. I have included the code I am using and the var_dump() of one of the rows I get back from the $result->fetch_assoc() line.
PHP Code:
$query = "SELECT * FROM news WHERE Topic LIKE '$topic' ORDER BY Date DESC" ;
$result = $this->mysqli->query($query);
$returned_ID = array();
while ( $row = $result->fetch_assoc() ) {
var_dump($row);
$returned_ID[] = $row['ID'];
}// end while rows returned
return $returned_ID;
var_dump result - (this is a news story I am pulling from the database with fields ID, date, category, title, and body)
array(5) { ["B"]=> string(2) "51" ["鈧