Answers for "mysqli_query()"

PHP
3

query php

<?php 
// MySqli connection
$mysqli = new mysqli("localhost", "my_username", "my_password", "my_database");

// Errors
if($mysqli->connect_error) {
  echo "<b>Failed to connect to MySQL: </b>" . $mysqli->connect_error;
}

// Query
$selectQuery = $mysqli->prepare("SELECT * FROM my_table");
$selectQuery->execute();
$selectQueryResult = $selectQuery->get_result();

// Loop 
while($selectQueryRow = $selectQueryResult->fetch_array()) {
  echo $selectQueryRow['my_column'];
}

// Example
$selectUsername = $mysqli->prepare("SELECT * FROM users");
$selectUsername->execute();
$selectUsernameResult = $selectUsername->get_result();
while($selectUsernameRow = $selectUsernameResult->fetch_array()) {
  echo $selectUsernameRow['username'];
}
Posted by: Guest on October-06-2020
0

PHP mysqli_query function

<?php
mysqli_query($db_handle,$query) ;
?>
Posted by: Guest on June-17-2021
0

mysqli query in php

$con = mysqli_connect('localhost','root','','db_name');
$sql2 = mysqli_query($con,"SELECT * FROM users WHERE email={'$email'}");
Posted by: Guest on August-25-2021

Browse Popular Code Answers by Language