Tags
Asked 5 years ago
13 Nov 2019
Views 592
kord

kord posted

how to use mysqli_query() Function ?

what is the proper way to use mysqli_query() Function ?
Nilesh

Nilesh
answered Nov 30 '-1 00:00

you can run any query by following syntax

mysqli_query($dbcon,"SELECT * FROM tablename ");

where $dbcon is the connection from the mysqli_connect

$dbcon=mysqli_connect("server name is here","database username is here ","database password is here ","database name is here");

so complete code like as below

// establish connection with Databse 
$dbcon=mysqli_connect("server name is here","database username is here ","database password is here ","database name is here"); 

//check if any problem in connection or not 
if (mysqli_connect_errno())
  {
  echo " MySQL Connection Error :  " . mysqli_connect_error();
  }

// run query it return instance which required perform fetch data operation
mysqli_query($dbcon,"SELECT * FROM tablename "); 

Post Answer