php - Failed to iterate over selected rows -
the code supposed row @ each loop , build td elements each data piece. however, gets rows while missing others though rows selected:
$query = "select * category"; $ret = mysql_query($query, $conn); while ($rows = mysql_fetch_assoc($ret)) { echo "<tr>"; foreach ($rows $val) { echo "<td>{$val}</td>"; } }
mysql_fetch_assoc returns associative array. display each returned row, (taken directly php.net page mysql_fetch_assoc
while ($row = mysql_fetch_assoc($result)) { echo $row["userid"]; echo $row["fullname"]; echo $row["userstatus"]; }
Comments
Post a Comment