I have a php script that inserts current date and value into a table.
The scripts work fine on my local system when run but trows up error when run as corn job in my cpanel.
Expand|Select|Wrap|Line Numbers
- <?php
- # FileName="Connection_php_mysql.htm"
- # Type="MYSQL"
- # HTTP="true"
- $hostname_dbconnect = "localhost";
- $database_dbconnect = "database";
- $username_dbconnect = "username";
- $password_dbconnect = "password";
- $dbconnect = mysql_pconnect($hostname_dbconnect, $username_dbconnect, $password_dbconnect) or trigger_error(mysql_error(),E_USER_ERROR);
- $date = date("Y-m-d");
- //$expiry = date ("Y-m-d", mktime (0,0,0,date("m")+12,(date("d")-1),date("Y")));
- $Date = curdate();
- $query = mysql_query("INSERT into counter (visit, date)
- VALUES('0', '$Date')");
- if($query === false)
- {
- die("could not insert into database");
- }
- ?>
could not insert into database
---------------End Error --------------------
Please what could be the cause and possible solution