This is the sample code which I got error, It works well in localhost when try to run the code in remote server is returns errors, Suggest me is there is any other way to achieve the same function in code.
<?php
if (!$con = mysql_connect('localhost', 'root', 'password')) {
die('An error occurred while connecting to the MySQL server!<br><br>' . mysql_error());
}
if (!mysql_select_db(sample)) {
die('An error occurred while connecting to the database!<br><br>' . mysql_error());
}
$sql = array(
'DROP TABLE IF EXISTS content;',
'CREATE TABLE content SELECT * FROM sample2.content'
);
if (sizeof($sql) > 0) {
foreach ($sql as $query) {
if (!mysql_query($query)) {
die('A MySQL error has occurred!<br><br>' . mysql_error());
}
}
}
mysql_close($con);
?>