affordit Posted March 12, 2008 Share Posted March 12, 2008 What I am trying to do is add the calendar date clicked on to the link. Can someone tell me whats wrong with this line please. echo "<td><a href=search2.php?post_date= date('Y-m-$day_num')> $day_num </a></td>"; Quote Link to comment Share on other sites More sharing options...
soycharliente Posted March 12, 2008 Share Posted March 12, 2008 You have a couple of things wrong with your code. 1. Don't try to call the date() function inside your string. 2. You're trying to format the date that is outputted by it with incorrect syntax. <?php $thedate = date('Y-m-d'); // this would say 2008-03-12 if you called it today echo "<td><a href=search2.php?post_date=$thedate> $day_num </a></td>"; ?> I don't exactly know what you're trying to do with $daynum inside date() though. Elaborate? Quote Link to comment Share on other sites More sharing options...
affordit Posted March 12, 2008 Author Share Posted March 12, 2008 I added this line just ahead of the anchor $day = date("Y,m,$day_num"); Now it works thanks I am using the link to pull the records from the table where the post_date is set as year month day. Is there an easier way? Quote Link to comment Share on other sites More sharing options...
soycharliente Posted March 12, 2008 Share Posted March 12, 2008 Oh wow. You need some quotes around your href too! Quote Link to comment Share on other sites More sharing options...
soycharliente Posted March 12, 2008 Share Posted March 12, 2008 That's going to return the date like this: 2008,03,whatever You changed that from before? Are you trying to grab the current year and month but change the day for all the links? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.