I have a simple php script which is ran from cli. I have tried many different variations of mysql code, but regardless, the line isnt inserted in the database even though php says it is....
<?php
$link = mysql_connect('localhost', '***', '***');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('***');
mysql_query("INSERT INTO email_log (to, from, subject, headers, message, source) VALUES ('1','2','3','4','5','6')");
printf("Last inserted record has id %d\n", mysql_insert_id());
?>
php test.php returns Last inserted record has id 0 and the same scripts work flawlessly through a web browser.
Things I have tried:
- I have changed file ownership to user that may effect it.
- 4-5 different INSERT codes