Reputation: 663
<?php
require "dbconnect.php";
$resultno = mysql_query("SELECT `time` FROM syslog");
while($row = mysql_fetch_array($resultno))
{
$mysqltime = $row['time'];
$timestamp = strtotime($mysqltime);
$update = date("Y-m-d H:i:s", $timestamp);
echo $update;
}
$mysqlupdate = mysql_query("INSERT INTO (`datetime`) VALUES ('$update')");
The results stream by but no updates? I must be missing something...
Thanks
Upvotes: 0
Views: 409
Reputation: 15
Besides what @Paulraj correctly pointed out, you are also passing your php variable as a string.
It should be "INSERT INTO (
datetime) VALUES ('" . $update . "')"
Upvotes: 0
Reputation: 17171
Perhaps you should look at the UPDATE command instead of insert. If you are looking to update, you shouldn't be using insert.
Upvotes: 0
Reputation: 3397
You have missed the table name in insert statement.
INSERT INTO tablename (`datetime`) VALUES ('$update')
Upvotes: 4