php - Compare date in a table to todays date -
im trying figure out how can make if statement compare todays date date field in table.
<?php $dayte_today = date('y-m-d'); $plannerid = $_get["plannerid"]; $sql="select * planner_content planner_id='$plannerid'"; $result=mysqli_query($con,$sql)or die(mysqli_error($con)); // mysql_num_row counting table row $count=mysqli_num_rows($result); if($count>=1){ /* echo "your id $userid"; */ while ($link = mysqli_fetch_object($result)) { echo ''.$link->date.' - '.$link->comment.'' ; } } else { echo "no events yet"; } ?> i've got show results moment, don't know how compare actual date date in table. tried use mysqli_fetch_object didn'y work.
why not compare dates using mysql's built-in date functions?
add column select statement uses datediff() return number can use in application logic.
Comments
Post a Comment