I'm having a strange issue with some PHP/SQL-code. I couldn't decide on whether I should put it in the PHP or the Database-Forum, so sorry, if I was wrong.
My problem is, that the PHP-code below doesn't create the table and prints this:
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 'USE Test_db; CREATE TABLE IF NOT EXISTS Test_tbl ' at line 2
The database, however, is created properly. The really strange thing about this is, that if I paste the SQL-part in phpMyAdmin, it works perfectly, without throwing any errors. So I have no clue, where the syntax-error is and why phpMyAdmin doesn't recognise it. My only theory is, that I screwed something up in the PHP-part :/
I'm testing this on a XAMPP local server, so I just pasted the PHP-file into htdocs, called "localhost" in Firefox (44.0) and selected the project there. I'm using Mac OS X 10.10.5.
Can anyone help me out?
What are your superhero powers? Go ahead and try them on this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop