Ik ben momenteel bezig met een setup-script in PHP. Dit setup script wordt automatisch uitgevoerd als de databaseconfiguratie niet werkt, of als het configuratiebestand niet aanwezig is. Dit goed, totdat ik de tabellen en records vanuit een pma dump wil invoegen in de MySQL (MyISAM) database. Ik krijg een SQL-syntax error:
Met dit PHP script:
code:
1
2
3
4
| 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 'CREATE TABLE IF NOT EXISTS comments ( id int(11) NOT NULL AUTO_INCREMENT, po' at line 4 |
Met dit PHP script:
PHP:
1
2
3
4
5
6
7
8
9
| <?php $handle = fopen($filename, 'r'); $data = fread($handle, filesize($filename)); $db-> select_db($database); $db -> query($data); if($db -> error){ die($db -> error); } ?> |
[ Voor 25% gewijzigd door Verwijderd op 10-01-2012 14:25 ]