import mysql blob data using php -
i trying save image data in mysql using blob format these inserted , retrieved correctly using php have problem , need create separate sql file data includes blob data when try import sql file not able import blob data
include 'database.inc.php'; if (isset($_files['sqlfile']) && !empty($_files['sqlfile'])) { $filename=$_files['sqlfile']['name']; $tmp_filename=$_files['sqlfile']['tmp_name']; move_uploaded_file($tmp_filename, $filename); $file_content=file_get_contents($filename); $commands = explode(';',trim($file_content)); foreach ($commands $command) { if(mysql_query($command)){ //header('location: '.$_server['http_referer']); } else { //echo 'failed import following command <br/>'.$command; echo mysql_error(); } } }
you'll have encode data in sql file, in this answer "how insert blob , clob files in mysql?".
Comments
Post a Comment