php - Prepared statement & binding the results to array -
i'm trying fetch rows database , put them array can't work out!
so fetch data so:
if ($archiveinfo = $mysqli->prepare('select date,title blog')) { $archiveinfo->execute(); $archiveinfo->close(); }
but not sure best code bind results array. i'm guessing 2 dimensional array i.e. $archiveinfo[0]['date']
how bind array , start echoing selected sections of array?
if ($archiveinfo = $mysqli->prepare('select date,title blog')) { $archiveinfo->execute(); $archiveinfo->bind_result($date, $title); /* fetch values */ while ($archiveinfo->fetch()) { echo $date." ".$title; } $archiveinfo->close(); }
you use http://php.net/manual/en/mysqli-result.fetch-array.php instead , loop through array..
Comments
Post a Comment