<?
if(!$res=mysql_connect('localhost','root',''))
{
echo "Error1";exit;
}
if(!$db=mysql_select_db('vision_old'))
{
echo "Error2";exit;
}
if (!function_exists('mysql_dump')) {
function mysql_dump1($database) {
$query = '';
$tables = @mysql_list_tables($database);
while ($row = @mysql_fetch_row($tables)) { $table_list[] = $row[0]; }
for ($i = 0; $i < @count($table_list); $i++) {
$results = mysql_query('DESCRIBE ' . $database . '.' . $table_list[$i]);
$query .= 'DROP TABLE IF EXISTS `' . $database . '.' . $table_list[$i] . '`;' . lnbr;
$query .= lnbr . 'CREATE TABLE `' . $database . '.' . $table_list[$i] . '` (' . lnbr;
$tmp = '';
while ($row = @mysql_fetch_assoc($results)) {
$query .= '`' . $row['Field'] . '` ' . $row['Type'];
if ($row['Null'] != 'YES') { $query .= ' NOT NULL'; }
if ($row['Default'] != '') { $query .= ' DEFAULT \'' . $row['Default'] . '\''; }
if ($row['Extra']) { $query .= ' ' . strtoupper($row['Extra']); }
if ($row['Key'] == 'PRI') { $tmp = 'primary key(' . $row['Field'] . ')'; }
$query .= ','. lnbr;
}
$query .= $tmp . lnbr . ');' . str_repeat(lnbr, 2);
$results = mysql_query('SELECT * FROM ' . $database . '.' . $table_list[$i]);
while ($row = @mysql_fetch_assoc($results)) {
$query .= 'INSERT INTO `' . $database . '.' . $table_list[$i] .'` (';
$data = Array();
while (list($key, $value) = @each($row)) { $data['keys'][] = $key; $data['values'][] = addslashes($value); }
$query .= join($data['keys'], ', ') . ')' . lnbr . 'VALUES (\'' . join($data['values'], '\', \'') . '\');' . lnbr;
}
$query .= str_repeat(lnbr, 2);
}
return $query;
}
}
$jjj=mysql_dump1('vision_old');
print_r($jjj);
?>
Secure file download in PHP, Security question PHP, PHP MYSQL Interview Question -Books download - PHP solutions guidelines queries update, phpmysqlquestion
Thursday, September 10, 2009
Subscribe to:
Post Comments (Atom)
How to solve mysql ERROR 1118 (42000) Row size too large
I had this issue with MYSQL 5.7 . The following worked althoug...
-
PHP has an SSH2 library which provides access to resources (shell, remote exec, tunneling, file transfer) on a remote ma...
-
Which pillar of the AWS Well-Architected Framework recommends maintaining infrastructure as code? Operational Excellence Which of the foll...
-
Introduction to PHP PDO (PHP Data Objects) 1. What is PDO 2. What Databases does PDO support 3. Where do I begin? 4. Connect to ...
No comments:
Post a Comment