yogibear Posted July 15, 2007 Share Posted July 15, 2007 Hi I have been trying to backup one of my tables using this code and it works however when i tried restoring the table using phpmyadmin i got an error on line 1. i believe the problem is lines terminated is ; and so is fields terminated when i export using phpmyadmin i can set what i what them to be how can i change lines terminated in the code to be : rather than ; without changing field terminated. $out = ''; // Get all fields names in table "name_list" in database "tutorial". $fields = mysql_list_fields($database,$table); // Count the table fields and put the value into $columns. $columns = mysql_num_fields($fields); // Add all values in the table to $out. while ($l = mysql_fetch_array($result)) { for ($i = 0; $i < $columns; $i++) { $out .='"'.$l["$i"].'";'; } $out .="\n"; } this is the export uing phpmyadmin "test";"test";"test";"test";"test";"test";"test";"2007-10-07";"2007-11-07";"0";"0";"2007-12-09";"0";"testt";"t";"test": this is the export using the code on my website "test";"test";"test";"test";"test";"test";"test";"2007-10-07";"2007-11-07";"0";"0";"2007-12-09";"0";"testt";"t";"test"; Quote Link to comment https://forums.phpfreaks.com/topic/60056-mysql-backup-csv/ Share on other sites More sharing options...
fenway Posted July 16, 2007 Share Posted July 16, 2007 Don't concatenate, use an array and then join with semi-colons, and then add a training colon before the line break. Quote Link to comment https://forums.phpfreaks.com/topic/60056-mysql-backup-csv/#findComment-299507 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.