mysql_fetch_row() function application description

 In PHP, you can use the mysql_fetch_row function to obtain the array result after the MySQL syntax is executed.


Use the syntax

array mysql_fetch_row (some code ),

where some code is the MySQL action you want to do. Usually the mysql_fetch_row() function will be used after mysql_query() , mysql_fetch_row The () function will store the execution result in an array and then return it, that is to say, the result of mysql_fetch_row execution will be an array. To display the execution result, the display mode of the array must be used.

Case study
<?php
 $connect = mysql_connect("localhost","account","password"); //Create a database connection
 $sql = "SELECT * FROM table"; //Search the taqble table
 $result=mysql_query( $ sql,$connect ); //Whether the return of $sql is executed correctly
 $show=mysql_fetch_row($result);
 print_r($show);
?>
In this example, the mysql_fetch_row function obtains the result of the mysql_query() execution, and saves it as an array ( PHP Array() ) and sends it back to us, so in the place shown at the end, we use the php print function. Display all the arrays instead of showing them one by one with the echo function.

Post a Comment

0 Comments