Note that there are some explanatory texts on larger screens.

plurals
  1. POhyperlink that calls data from mysql
    primarykey
    data
    text
    <p>I'm trying to create a page with a hyperlinks that when clicked will display all the records in the table with a reminder date that is within the current week (Sun-Sat) however by defaul all reminders for the current day are showing. Thanks for your help!</p> <pre><code>// not sure how to create the link for 'Week' &lt;li&gt;&lt;a href="/backend/followup/followup.php"&gt;Today&lt;/a&gt;&lt;/li&gt; // default page &lt;li&gt;&lt;a href="/backend/followup/followup.php?reminder="&gt;Week&lt;/a&gt;&lt;/li&gt; </code></pre> <p></p> <p>Here is what I have so far and I'm not sure how to put this all together so that by default all reminders for today show up, but if hyperlink 'Week' is clicked only those results show up</p> <pre><code>$today = date('Y-m-d', strtotime('today')); $week = date('Y-m-d', strtotime('last sunday')); $query = "SELECT * FROM contacttodo,contacts WHERE contacttodo.contacts_id = contacts.ID AND contacttodo.reminder = '$today' ORDER BY contacttodo.reminder ASC"; $query = "SELECT * FROM contacttodo,contacts WHERE contacttodo.contacts_id = contacts.ID AND contacttodo.reminder BETWEEN '$week' AND '$week' + INTERVAL 6 DAY ORDER BY contacttodo.reminder ASC"; </code></pre> <p>UPDATE- This is working (except for 'lastweek'):</p> <pre><code>if($_GET['reminder'] == 'lastweek') { $lastweek = date('Y-m-d', strtotime('last sunday')); $query = "SELECT * FROM contacttodo,contacts WHERE contacttodo.contacts_id = contacts.ID AND contacttodo.reminder BETWEEN '$lastweek' AND '$lastweek' - INTERVAL 6 DAY ORDER BY contacttodo.reminder ASC"; } elseif ($_GET['reminder'] == 'thisweek') { $thisweek = date('Y-m-d', strtotime('last sunday')); $query = "SELECT * FROM contacttodo,contacts WHERE contacttodo.contacts_id = contacts.ID AND contacttodo.reminder BETWEEN '$thisweek' AND '$thisweek' + INTERVAL 6 DAY ORDER BY contacttodo.reminder ASC"; } elseif ($_GET['reminder'] == 'nextweek') { $nextweek = date('Y-m-d', strtotime('next sunday')); $query = "SELECT * FROM contacttodo,contacts WHERE contacttodo.contacts_id = contacts.ID AND contacttodo.reminder BETWEEN '$nextweek' AND '$nextweek' + INTERVAL 6 DAY ORDER BY contacttodo.reminder ASC"; } elseif ($_GET['reminder'] == 'thismonth') { $thismonth = date('Y-m-d'); $query = "SELECT * FROM contacttodo,contacts WHERE contacttodo.contacts_id = contacts.ID AND YEAR(reminder) = YEAR(CURDATE()) AND MONTH(reminder) = MONTH(CURDATE())ORDER BY contacttodo.reminder ASC"; } elseif ($_GET['reminder'] == 'thisquarter') { $thisquarter = date('Y-m-d'); $query = "SELECT * FROM contacttodo,contacts WHERE contacttodo.contacts_id = contacts.ID AND YEAR(reminder) = YEAR(CURDATE()) AND QUARTER(reminder) = QUARTER(CURDATE())ORDER BY contacttodo.reminder ASC"; } elseif ($_GET['reminder'] == 'thisyear') { $thisyear = date('Y-m-d'); $query = "SELECT * FROM contacttodo,contacts WHERE contacttodo.contacts_id = contacts.ID AND YEAR(reminder) = YEAR(CURDATE()) ORDER BY contacttodo.reminder ASC"; } else { $today = date('Y-m-d', strtotime('today')); $query = "SELECT * FROM contacttodo,contacts WHERE contacttodo.contacts_id = contacts.ID AND contacttodo.reminder = '$today' ORDER BY contacttodo.reminder ASC"; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload