Php mysql dökümü nasıl kullanılır

0 Cevap php

I've tried using mysql dump in the command line and it worked. How do I do it in php? I found this code from the internet, and tried it.

<?php
ob_start();

$username = "root"; 
$password = "mypassword"; 
$hostname = "localhost"; 
$sConnString = mysql_connect($hostname, $username, $password) 
or die("Unable to connect to MySQL");


$connection = mysql_select_db("test",$sConnString) 
or die("Could not select DB");
$command ="C:\wamp\bin\mysql\mysql5.1.36\bin --add-drop-table --host=$hostname --databases test > C:\wamp\www\test\tester.sql"; 

I don't really understand what this following code means: system($command);

$dump = ob_get_contents(); 
ob_end_clean();



$fp = fopen("dump.sql", "w"); 
fputs($fp, $dump); 
fclose($fp);

?>

. Ben bir veritabanına oluşturulan sql dosyası ithal ve ben phpmyadmin bu hata var:

There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unknown Punctuation String @ 3
STR: :\
SQL: 
E:\Users\Nrew\Documents>set path=C:\wamp\bin\mysql\mysql5.1.36\bin;
E:\Users\Nrew\Documents>set path=C:\wamp\bin\mysql\mysql5.1.36\bin;
E:\Users\Nrew\Documents>set path=C:\wamp\bin\mysql\mysql5.1.36\bin;

SQL query:

E:\Users\Nrew\Documents>set path=C:\wamp\bin\mysql\mysql5.1.36\bin;

MySQL said: 

#1064 - 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 'E:\Users\Nrew\Documents>set path=C:\wamp\bin\mysql\mysql5.1.36\bin' at line 1 

Ben php bunu öğrenmek istiyorum, lütfen yardım edin.

0 Cevap