-1

OK i am having an issue getting a piece of code to work i am trying to grab rows from a DB that are a day old using MySQL INTERVAL The Rows are updated after my script runs using the NOW() being added to "TIME_STAMP_FIELD".

mysqli_query($con,"SELECT * FROM My_table WHERE TIME_STAMP_FIELD > UNIX_TIMESTAMP(NOW() -    INTERVAL 1 DAY)");
while($row = mysqli_fetch_array($result))
{ /*...*/ }

But the issue i have tryed a few ways to get this but i keep getting. this Warning:

mysqli_fetch_array() expects parameter 1 to be mysqli_result,null given in...

and thing it lists the name of my script and line of the error.

Now this is going on even though i know the time stamps are more then a day old in the DB right now would anyone know why i mite be getting a NULL result?

shadyyx
  • 15,526
  • 6
  • 53
  • 94
  • 1
    From the code snippet, it looks like you are not storing the the result in the variable `$result` but trying to access it, which is why you are getting null. – heretolearn Oct 19 '13 at 14:33

1 Answers1

0
$result=mysqli_query($con,"SELECT * FROM My_table WHERE TIME_STAMP_FIELD > UNIX_TIMESTAMP(NOW() -    INTERVAL 1 DAY)");
while($row = mysqli_fetch_array($result))
Jelle Ferwerda
  • 1,269
  • 1
  • 7
  • 13