|
Posted by caine on 05/07/07 08:41
I'm extracting web data from dynamically generated RSS. So, my coding
generally looks like this:
<?php
$datetime = date("Y-n-j");
//check desired information bla bla
$qry = "INSERT INTO `bul_data` (`DATE`, `TITLE`,
`DEPARTMENT`,`CAMPUS`, `LINK`) VALUES (DATE_ADD('$datetime', INTERVAL
1 DAY),'$title','$category','', '$link')";
//auto update queries
$qry1 = "UPDATE `bul_data` SET DATE=DATE_ADD('$datetime', INTERVAL 1
DAY), TITLE='$title', DEPARTMENT='$category', CAMPUS='',
LINK='$link'";
//auto delete expired queries
$qry2 = "DELETE FROM `bul_data` WHERE `DATE` LIKE '{$title_date}' >
SUBDATE('$datetime', INTERVAL 1 DAY)";
$res = mysql_query($qry) OR die(mysql_error());
mysql_query($qry);
echo "New bulletin have been stored.";
mysql_query($qry1);
echo "Records have been updated.";
mysql_query($qry2);
echo "Expired bulletin have been deleted.";
?>
However, it doesn't work to insert desired information into my
database. It works only if I omit the DATE_ADD() function and replace
it with '$datetime'.
Navigation:
[Reply to this message]
|