
[![enter image description here][1]][1]/*=================================================================================================================
mysqli_fetch_assoc - returns data in an associative array
mysqli_fetch_row - returns data in a numeric array
mysqli_fetch_array - returns data in both an associative and a numeric array
*/
$query2 = "SELECT * FROM User";
//$result3 = mysqli_query ( $con, $query2) or die ("Couldn't execute SELECT query");
$result3 = mysqli_query ( $con, $query2) or die (mysqli_error($con));
$row = mysqli_fetch_assoc($result3); //returns an array called $row with column names as keys. Get one row of data
//If you need more than one row of data, use the function in a loop
echo $row['Title'] ." - ". $row['FName'] ." - ". $row['LName']; //one row of data. It is fine when checking a password
//extract function - splits the array into variables that have same name as the key
extract($row);
echo "".$FName; //variable having same name as the key, also identical to column name
echo "
Number of rows in the User table: ".mysqli_num_rows($result3);
echo "";
echo "User Id Title First Name Last Name Email";
while( $row = mysqli_fetch_assoc($result3) ){
extract($row);
echo "";
echo "".$UserId."" . "".$Title."" . "".$FName."" . "".$LName."" . "".$Email."" ;
echo "";
}
echo "";
echo "My connection to the MySQL database";
Подробнее здесь: https://stackoverflow.com/questions/366 ... c-not-work
Мобильная версия