hi this is a function i wrote to get the content of a table such as phpmyadmin does...
my problem is that all newlines are not replaced with \r\n so the file looks pretty messy .... after some research i found a fix for it but this also doesnt work !!! please help
function get_table_content($table) {
$crlf = "\r\n";
##fix newlines
$find = array("\x00", "\x0a", "\x0d", "\x1a");
$replace = array('\0', '\n', '\r', '\Z');
global $db;
$dump="";
$result = $db->query("SELECT * FROM ".$table);
while($row = $db->fetch_array($result)) {
$dump .= "INSERT INTO $table VALUES (";
$z=0;
foreach($row as $x=>$y) {
$y = addslashes($y);
if($z==sizeof($row)-1) {
$y = str_replace($find, $replace, $y);
$dump .= "'$y');$crlf";
} else {
$dump .= "'$y', ";
}
$z++;
}
}
return $dump;
}