MySQL fetch query PHP

122

There are only 30 values in the table butmysqli_num_rows($result) return 60 Same query is being executed twice , here is the code :

<?php 

error_reporting(E_ALL);
$con=mysqli_connect('127.0.0.1','***','***','***');
if (mysqli_connect_errno()) {
    # code...
    echo "Could not connect to MYSQL database".mysqli_connect_error();
}

$sql = "select * from ticket_staff";
$result = mysqli_query($con, $sql);
echo mysqli_num_rows($result);
if (mysqli_num_rows($result) > 0) {
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) {
        echo   $row["t_ID"]."<br>";
    }
} else {
    echo "0 results";
}


?>

here is the screenshot of output

People are also looking for solutions to the problem: php - Symfony 4, find() an entity

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.