I'm developing an android app, which gets data from an mysql-database from server. I'm hosting a local server mysql-database and want to get all data from a table named "require
".
In my PHP script I'm doing the following:
<?php
mysql_connect("localhost", "root", "");
mysql_select_db("meinstudiumosdatabase");
$q = mysql_query("SELECT * FROM require");
echo mysql_error();
while($row = mysql_fetch_assoc($q)){
$output[] = $row;
}
print(json_encode($output));
mysql_close();
?>
The mysql_query
fails with the 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 'require' at line 1.
Where is the problem? The require table has two integer columns, nothing special. I have 6 other tables where this script works fine. Hope you can help.
EDIT:
Changed title, so people who used "require
" as tablename find this easier.
Greetings Kai