Click here to Skip to main content
15,915,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
<?php 
$host   =  'localhost';
$user = 'root';
$password = 'root';
$database  =  's5_db';
$port   =   '8889';
$socket = '/Applications/MAMP/tmp/mysql/mysql.sock';





$conn  = mysqli_connect($host, $user, $password, $database, $port, $socket);

 if (!$conn) {
     
     die("failed connection : ". mysqli_connect_error());
 } else {
     echo "connection pass : ";
}


after testing the code it shows connection pass but after i run the following code on another script
which follows :


$test = mysqli_query($conn);



if(!$test){
echo 'conn has an error';
} else {
echo 'conn is okay no errors ';
}

it returns conn has an error
please point to me my error
Posted

1 solution

You are using the function mysqli_query wrong.

read this:

http://www.w3schools.com/php/func_mysqli_query.asp[^]
 
Share this answer
 
Comments
sean871 20-Dec-15 21:37pm    
idk nothing i did works , followed your link to w3schools

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900