php - MySQL returns one row -
i have php code
if ($settings['ht_showlastwinners'] == 'yes') { $query = $db->query('select * ht_history '); if ($row = $db->fetch_array( $query )) { $row['username'] = $db->fetchone('select username members id=' . $row['user_id'] ); $htwinners[] = $row; } $smarty->assign( 'htwinners', $htwinners ); }
when on .tpl file use
{section name=w loop=$htwinners} <tr> <td>{$htwinners[w].username}</td> <td>{$htwinners[w].bet}</td> <td>${$htwinners[w].win}</td> </tr> {/section}
it gives me 1 row. tried print value of htwinners in php page , gives me 1 row, suppose problem code, when "copies" data $ht_history in new $htwinners associating/replacing user id username, fetches 1 row.
thanks in advance answers, i'm pratical (not lot) on php, tried similar code-problems, didn't find , code have looks me without error restricted knowledge, i'm wrong.
- change "if" "while"
- you need change "$db" "$query"
- check parameter type fetch_array. expects result type constant integer
while ($row = $query->fetch_array( mysqli_assoc )) {
Comments
Post a Comment