I created a script that outputs the following code into a PHP file for EACH table in the database. I am using this as a "ready to run" backup script that i can just include and it will drop all tables, recreate the tables and then reinsert each value.
For some reason i can only get the code to drop the tables, any help is much appreciated.
mysql_query("INSERT INTO usr VALUES ('1', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, <span style=\"font-weight: bold;\">sed diam voluptua</span>. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, <span style=\"font-style: italic;\">consetetur sadipscing elitr</span>, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. <br><ul><li><span style=\"font-weight: bold;\">ro eos et accusam eAt vet justo duo dolores et ea rebum</span>.</li><li> Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. <br></li><li style=\"font-weight: bold;\">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</li><li> At vero eos et accusam et justo duo dolores et ea rebum. <br></li><li style=\"font-weight: bold;\">Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</li></ul>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. <br>', 'StandingHandInPocket.JPG', '350', '233', 'Home', 'Welcome!', 'n', 'n',)");
mysql_query("INSERT INTO page VALUES ('2', 'asd<span style=\"font-weight: bold;\">fgafgadfg</span><br>', NULL,NULL,NULL,'page 2', 'header2', NULL,NULL)");
mysql_query("INSERT INTO page VALUES ('5', '<br>', NULL,NULL,NULL,NULL,NULL,'y', NULL)");
mysql_query("INSERT INTO page VALUES ('3', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)");
mysql_query("INSERT INTO page VALUES ('4', NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)");
It just errors the MySQL syntax, there is no specific 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 'string(100) not_null, conm string(100) not_null, lk1 string(100) not_null' at line 1
and as i go down the line and remove the create table code it just errors the next one in line.
its basically the same, the script outputs the same for each table so it should be uniform. Also it errors on EVERY table creation when i take out the previous one it will still error. But here is the code the above error came from...
you do realise that NOT NULL should be done with a space not an underscore right(which I can't believe I didn't notice before)?
You also realise that string is not a valid field type as well, right? it's either VARCHAR for variable up to the length, or CHAR which is fixed to the length(CHAR is quicker to access since there's less reading, but it's also more space...)
If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
The same applies to HTML and the forums [HTML][/HTML] tags.
Bookmarks