Hi all, I’m new to PHP have written some code to extract data from mysql. here it is
<?php echo "Testing Database...."; $con = mysqli_connect('localhost', 'db_id', 'my_pw', 'mysql_db'); $result = $con->query("SELECT user_id FROM users"); echo "Number of users : ".$result->num_rows."
"; $row = mysqli_fetch_row($result);
echo $row[0]."<br>";
echo $row[1]."<br>";
echo $row[2]."<br>";
?>
</body>
in result number of rows its giving right, but when i fetch the result in row, its giving only first row. rest all are empty.
then further i have tested few more things like, i change the query as below
‘SELECT * FROM users’
now this is giving another strange result. It selected first row of the table and making array for all available columns.
i have attached herewith image of my table, and result of both of my queries.
Could someone guide me on this issue…