I have a client that needs to import an SQL file that contains just regular old Insert statements into the database on a regular basis. He's asked me to create a simple interface to do this (doesn't want to deal with phpmyadmin) in which they just select the file from their computer, click submit, and it does what it needs to.
Sample info from his files:
INSERT INTO HisTable VALUES ('Jim','Smith','23','email@email.com');
INSERT INTO Cards VALUES ('Jane','Roberts','43','email@email.com');
So I've written a form that allows you to upload the file -- but now I'm sort of stuck. I gather I want to take the contents of the uploaded file and read it into a string? And then just run that as a mysql_query? I tried:
$string = file($uploadedD😎;
mysql_query($string) or die(mysql_error());
But it doesn't seem to like that -- it gives me the following message:
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 'Array' at line 1
So...what am I doing wrong? Any tips that you can give me?