Mysqli Query Results to Show All Rows

mysqli query results to show all rows

Just replace it with mysqli_fetch_array or mysqli_result::fetch_array :)

while( $row = $result->fetch_array() )
{
echo $row['FirstName'] . " " . $row['LastName'];
echo "<br />";
}

Almost all mysql_* functions have a corresponding mysqli_* function.

Print the Result of a mysqli SELECT Query

Use Fetch to display the result

     $result = mysqli_query($con,"SELECT * FROM user_list where username = '" . mysqli_real_escape_string($con, $username) . "'"); 
while($row = mysqli_fetch_array($result))
{
print_r($row);
}

mysqli select all rows starting with letter

Try putting quotes around the variable in the query so that it looks like this :

$result = $mysqli->query("SELECT * FROM my_table WHERE column LIKE '$type'");

This will probably solve the problem.

How to echo each row from mySQLi query using PHP?

Try this:

$qry = "SELECT * FROM campaign WHERE user_id=1";
$res = mysqli_query($conn, $qry);

if(mysqli_num_rows($res) > 0) // checking if there is any row in the resultset
{
while($row = mysqli_fetch_assoc($res)) // Iterate for each rows
{
?>
<li>
<a>
<div>
<p><?php echo($row['campaign_name']); ?></p>
<p>
Description Text
</p>
</div>
</a>
</li>
<?php
}
}

It will iterate for each row in the resultset.

Display array results in a table from mysqli query

I figured out what my problem was

while ($row = mysqli_fetch_array($result2)){
echo "".$row['szName'] . "<br>";

The code works exactly how I needed it to. I don't have to worry about injection as the site for this is restricted by IP address and double authentication.

Printing mysqli query results

try this:

<?php
include 'header.php';
include 'conect.php';
$resultArray = array();
$resultlog = mysqli_query($con, "SELECT * from cpi");
while($row = mysqli_fetch_array($resultlog)){
$resultArray[] = $row;
}
mysqli_close($con);
print_r($resultArray);

?>

Mysqli Query not pulling all results?

you have to use a while loop

while($row = $result->fetch_assoc()){ ?>
<tr>
<td><?php echo $rank++; ?></td>
<td><?php echo $row['league_name']; ?></td>
<td><?php echo $row['total']; ?></td>
</tr>
<?php } ?>

Mysqli while dont show all rows

You're fetching the first row and assigning it to $news. This means that it's already been fetched when you begin your loop. Remove that line and it should work fine.



Related Topics



Leave a reply



Submit