I have written a php script for returning every thing in database in json format. The following code is giving me this error.
You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ''userCredentials'' at line 1
mysql_fetch_assoc() expects parameter 1 to be resource, boolean given
here is the code:
<?php
require 'testconnect.php';
$sql = "SELECT * FROM 'userCredentials'";
$query = mysql_query($sql);
if($query == false){
echo mysql_error();
echo 'failed query connect';
}
echo 'new success';
while($row = mysql_fetch_assoc($query)) {
echo json_encode($row);
}
?>
What is wrong with this code? Am I missing something?
PS: I am not PHP programmer. I wrote this script to use this in my java code.
Regards