Answers for "echo mysqli_fetch_assoc in array"

SQL
3

mysqli_fetch_assoc

<?php
	/* Connect to your database */
	$con = mysqli_query("hostname", "username", "pwd", "database");
    /* Select Columns from table*/
    $sql = "SELECT * FROM `TABLE`";
    /* Query your SQL code to SQLDatabase */
    $result = mysqli_query($con, $sql);
    /* Find rows in table*/
    $check = mysqli_num_rows($result);
    if($check > 0){
    while($data= mysqli_fetch_assoc($result)){
    /* Print all of your data*/
    echo $data["ColName"];
    }
    }
?>
Posted by: Guest on December-29-2019
0

mysqli fetch row assoc

$sql = "SELECT Lastname, Age FROM Persons ORDER BY Lastname";
$result = mysqli_query($con, $sql);


/*MYSQLI_ASSOC
MYSQLI_NUM (this is default)
MYSQLI_BOTH
  */
// Fetch all
mysqli_fetch_all($result, MYSQLI_ASSOC);
Posted by: Guest on August-15-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language