Bopo Posted May 6, 2009 Share Posted May 6, 2009 Hi Well basically I think there's something wrong with the following code, even if a row is returned, I am still getting a new record with no data appearing in my mysql database, wondering if anyone can see anything: <?php $date = date('Y/m/d'); date('F, Y',strtotime($date)); include("admin/blogconnect.php"); $breakdate = explode(" ", date('F, Y',strtotime($date))); $removecomma = substr($breakdate[0], 0, -1); $sql = "SELECT * FROM months where month = '$storemonth' AND year = '$storeyear'"; $query = mysql_query($sql, $connect); if(mysql_num_rows($query)== 0) { $sql1 = "INSERT INTO months (month, year) VALUES ('$storemonth', '$storeyear')"; if(!mysql_query($sql1, $connect)) { die('Error' . mysql_error()); } } else { exit (); } mysql_close($connect); ?> Link to comment https://forums.phpfreaks.com/topic/157022-insert-statement/ Share on other sites More sharing options...
Ken2k7 Posted May 6, 2009 Share Posted May 6, 2009 What's $storemonth and $storeyear? Link to comment https://forums.phpfreaks.com/topic/157022-insert-statement/#findComment-827155 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.