mySQL INSERT Statements and phpMyAdmin
If you’re a non-technical person, read the title and get a hint. ;) Of course, you’re welcome to stay, but you’ll probably be bored.
Now down to the meat of it.
phpMyAdmin is a sweet tool for messing with your mySQL databases. But for some reason, in most versions (all that I’ve used), it really botches up the PHP code it spits out for you to use in your own PHP scripts. So as a service to all you PHP coders out there, here’s how it’s supposed to look:
INSERT INTO TableName (ID, Name, Address, Phone, City, State) VALUES ('', 'Billy Bob', '123 Main Street', NULL, 'New York', 'NY')
Your variable would then look something like this:
$SQL = "ALL THAT STUFF GOES IN HERE";
Or more accurately, like this:
$SQL = "INSERT INTO TableName (ID, Name, Address, Phone, City, State) VALUES ('', 'Billy Bob', '123 Main Street', NULL, 'New York', 'NY')";
Now don’t say I never gave you nuthin’. It’s bad grammar.

tim is the author. Nov 21, 07:59 is the time. <
The most ironic part, perhaps, is that phpMyAdmin claims the code to be actual PHP code. To that, I say, “HA!”
Nathan Logan is the author. Nov 21, 11:22 is the time. <
Do you mean that it’s missing the php $sql= statement?
I think the export form the DB is straight SQL, and not intended to be PHP, but just SQL.
I’ve used it, and i think the output is pretty standard:
INSERT INTO `hettnuke_advanced_polls_data` VALUES (5, ‘Atari’, 8, ‘’);
tim hettinger is the author. Nov 22, 15:16 is the time. <
INSERT INTO `TableName` (`ID`, `Name`, `Address`, `Phone`, `City`, `State`) VALUES (‘’, ‘Billy Bob’, ‘123 Main Street’, NULL, ‘New York’, ‘NY’)
And that code never ceases to fail for me when I’m trying to insert from PHP into a mySQL database. Removing the errant ` marks seems to take care of it (and there may be some other slight changes, although I can’t remember at this moment).
Nathan Logan is the author. Nov 25, 19:50 is the time. <
i’ll make sure and not find it. :)
tim is the author. Nov 28, 08:04 is the time. <