I'm working on a script to create back-up's of a database. It's not complete because it only generates the "insert into" commands, it doesn't generate the "create database" or "create table" ones, but I wondered if there is another way to create a back-up's of a database that can only be accessed through the web. Script (replace '[' and ']'): [?php $link = mysql_connect("127.0.0.1","root","password"); $bd = "my_database"; $result = mysql_listtables ($bd); $i = 0; while ($i [ mysql_num_rows ($result)) { $tb_names[$i] = mysql_tablename ($result, $i); $result_fields = mysql_db_query($bd, "desc ".$tb_names[$i]); $j = 0; $campos = array(); $tipos = array(); while ($field = mysql_fetch_array($result_fields)){ $campos[$j] = $field["Field"]; $tipos[$j++] = $field["Type"]; } mysql_free_result($result_fields); $result_query = mysql_db_query($bd, "select * from ".$tb_names[$i]); if (mysql_num_rows($result_query) ] 0){ echo "DELETE * FROM ".$tb_names[$i] ."[br]"; echo "COMMIT;[br]"; echo "INSERT INTO ".$tb_names[$i] ."("; echo join(", ", $campos).") VALUES[br]"; $l = 0; $lineas = array(); while ($datos = mysql_fetch_array($result_query)){ $k = 0; $linea = array(); while ($k [ $j){ if (is_null($datos[$k])){ $linea[$k] = "NULL"; } else { $linea[$k] = '"'.str_replace(chr(13).chr(10),"\\r\\n",$datos[$k]).'"'; } $k++; } $lineas[$l++] = "(".join(", ", $linea).")"; } echo join(",[br]", $lineas).";[br]COMMIT;[br][br]"; } $i++; mysql_free_result($result_query); } mysql_close($link); ?] -- View this message in context: http://www.nabble.com/Is-there-something-similar-to-this-out-there--tf3730521.html#a10442248 Sent from the Php - Database mailing list archive at Nabble.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php