You don't execute PHP at a command line. I thought you didn't have SSH access anyway, so you wouldn't be able to write a command such as the aforementioned. So you don't need that execute command.
Anyway, I'll walk you through it now. OK, try doing like this - that code that was initially posted was from one of my projects. I thought it was generic, but you are getting errors. Here is a better, more generic, more documented piece.
PHP Code:
<?php
/* Connecting, selecting database */
$link = mysql_connect("mysql_host", "mysql_user", "mysql_password")
or die("Could not connect : " . mysql_error());
echo "Connected successfully";
mysql_select_db("my_database") or die("Could not select database");
/* Performing SQL query */
$query = "Contents of your backup.sql file on one line";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
/* Printing results in HTML */
//You don't need to do this.
if($result) {
echo 'done';
}
/* Free resultset */
mysql_free_result($result);
/* Closing connection */
mysql_close($link);
?>
1) Copy and paste this code into a file.
2) Change the details for dbhost, username, password, and dbname.
3) Paste the contents of your backup.sql file on one line.
4) Within your backup.sql, if the sql contains any " you will need to change them to \" so that PHP knows you don't want to close the string.
5) If you get stuck again, post your SQL file too, and i'll put it into the PHP code. But please try to do it yourself first.
6) By doing something yourself, you learn how to do it.
Any problems, post back.
