This website CMS I'm working on is starting to get complicated and I wanted to add a new feature to the whole site. Firstly I should say that there is a free and a premium site to site because of the art that is being sold by artist (well at least that is what I'm going for), and I wanted to have a single page or panel that had the updates on it. Like new stock video, or new print, ect ect. So I made a table in sql but not I'm stuck on some logic problems with how that is updated because some days will not have some types of content versus other kinds, and I don't want to do it manually (who would with these tools in front of us), but rather it gets updated when I use the posting admin panel or an aritist dose.
Anyway, here is the real question. In php how do I check a table for a date from the database? Like an if() statement?
example of what I was thinking:(not code correct at all)
Code: Select all
<?
mysql_connect();
mysql_select_db();
//check if today has an entry
$sql = "SELECT * FROM table WHERE DATETIME = TODAY LIMIT 0,1";
$sql_result = mysql_query($sql);
if($sql_result){
//UPDATE ENTRY
}else{
//INSERT NEW ENTRY FOR TODAY INTO TABLE
}
?>