What is the significance of using MYSQL_ASSOC in mysqli_fetch_array() in PHP?
When using mysqli_fetch_array() in PHP, the MYSQL_ASSOC flag is used to fetch a row as an associative array, where the keys are the column names. This is significant because it allows for easier access to specific columns by their names rather than numerical indices.
// Connect to database
$connection = mysqli_connect("localhost", "username", "password", "database");
// Fetch a row as an associative array
$result = mysqli_query($connection, "SELECT * FROM table");
$row = mysqli_fetch_array($result, MYSQL_ASSOC);
// Access specific columns by their names
echo $row['column_name'];