Change the mysql.ini file, set:
wait_timeout = 600 max_allowed_packet = 64
Resource:
http://stackoverflow.com/questions/12425287/mysql-server-has-gone-away-when-importing-large-sql-file
by Rolf van Gelder | CAGE Web Design, Eindhoven
Change the mysql.ini file, set:
wait_timeout = 600 max_allowed_packet = 64
Resource:
http://stackoverflow.com/questions/12425287/mysql-server-has-gone-away-when-importing-large-sql-file
Syntax for MySQL and MySQLi Functions
mysql Function | mysqli Function |
---|---|
mysql_connect($host, $user, $passwd) – followed by – mysql_select_db($dbname) |
mysqli_connect($host, $user, $passwd, $dbname) |
mysql_errno() or mysql_errno($cxn) | mysqli_errno($cxn) |
mysql_error() or mysql_error($cxn) | mysqli_error($cxn) |
mysql_fetch_array($result) | mysqli_fetch_array($result) |
mysql_fetch_assoc($result) | mysqli_fetch_assoc($result) |
mysql_fetch_row($result) | mysqli_fetch_row($result) |
mysql_field_name($result, $i) | $field_name = mysqli_fetch_field_direct($result, $i)->name; |
mysql_field_type($result, $i) | $field_type = mysqli_fetch_field_direct($result, $i)->type; |
mysql_free_result($result) | mysqli_free_result($result) |
mysql_get_server_info()() | mysqli_get_server_info($cxn) |
mysql_insert_id($cxn) | mysqli_insert_id($cxn) |
mysql_num_fields($result) | mysqli_num_fields($result) |
mysql_num_rows($result) | mysqli_num_rows($result) |
mysql_query($sql) – or – mysql_query($sql, $cxn) |
mysqli_query($cxn, $sql) |
mysql_real_escape_string($data) | mysqli_real_escape_string($cxn, $data) |
mysql_select_db($dbname) | mysqli_select_db($cxn, $dbname) |
How to put all the MySQL table names into an array?
Best method:
$tables = $wpdb->get_results("SHOW TABLES FROM `".DB_NAME."`", ARRAY_N); for ($i=0; $i<count($tables); $i++) echo $tables[$i][0].'<br />';
Second method:
$res = mysql_query("SHOW TABLES FROM `".DB_NAME."`"); $tables = array(); while($row = mysql_fetch_array($res, MYSQL_NUM)) $tables[] = "$row[0]";
$tables will hold all the table names.