I am trying this piece of code for hours. I am not able to figure out what my error is.
$conn = mysqli_connect('localhost', 'user', 'pass', 'mydb')
or die( "Unable to connect");
$check = mysqli_query($conn, "select * from Users where Fuid='$fbid'",
MYSQLI_STORE_RESULT);
$rows = mysqli_num_rows($check);
if (empty($rows)) { // if new user . Insert a new record
$query = "INSERT INTO Users (Fuid,Funame,Ffname,Femail)
VALUES ('$fbid','$funame','$ffname','$femail')";
mysqli_query($conn, $query);
}
There might be a very small error, but I am just fried up.
Cannot connect to DB: ' . mysqli_connect_error() . '
'; – Len_D Jun 04 '14 at 05:10