Issue
I understand how to fetch a result in mysqli, but how would this example be coded for mysqli?
for ($i = 0; $i < $num_rows; $i++) {
$uname = mysql_result($result, $i, "username");
$email = mysql_result($result, $i, "email");
echo "<tr><td>$uname</td><td>$email</td></tr>\n";
}
Thanks for taking a look
Solution
You can do like this:
while ($row = mysqli_fetch_assoc($result)) {
$uname = $row["username"];
$email = $row["email"];
echo "<tr><td>$uname</td><td>$email</td></tr>\n";
}
Answered By - spirit Answer Checked By - Terry (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.