Jump to content

Recommended Posts

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";

Link to comment
https://forums.phpfreaks.com/topic/60056-mysql-backup-csv/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.