Gayner Posted August 6, 2009 Share Posted August 6, 2009 Hi everyone, thanks in advance, lol: This is my DB Query: $DB->query("SELECT * FROM ibf_logs WHERE receiver_id = '{$ibforums->member["id"]}' && month = '$month' && year = '$year' or sender_id = {$ibforums->member["id"]} && month = '$month' && year = '$year' order by date_time DESC"); But I Want it to only do $DB->query("SELECT * FROM ibf_logs"); If a user clicks on a something like index.php?&SHOWALL $_GEt function possible? Thanks! Link to comment https://forums.phpfreaks.com/topic/169049-help-with-_get-function-please/ Share on other sites More sharing options...
smerny Posted August 6, 2009 Share Posted August 6, 2009 do something like index.php?mode=showall then $_GET['mode'] would be "showall" Link to comment https://forums.phpfreaks.com/topic/169049-help-with-_get-function-please/#findComment-891915 Share on other sites More sharing options...
Gayner Posted August 6, 2009 Author Share Posted August 6, 2009 HOw would i set that up ?lol Link to comment https://forums.phpfreaks.com/topic/169049-help-with-_get-function-please/#findComment-891934 Share on other sites More sharing options...
Zepo. Posted August 6, 2009 Share Posted August 6, 2009 Like this. if($_GET['mode'] == "showall"){ $qvar=""; }else{ $qvar="WHERE receiver_id = '{$ibforums->member["id"]}' && month = '$month' && year = '$year' or sender_id = {$ibforums->member["id"]} && month = '$month' && year = '$year' order by date_time DESC"; } $DB->query("SELECT * FROM ibf_logs $qvar"); OR if($_GET['mode'] == "showall"){ $DB->query("SELECT * FROM ibf_logs"); }else{ $DB->query("SELECT * FROM ibf_logs WHERE receiver_id = '{$ibforums->member["id"]}' && month = '$month' && year = '$year' or sender_id = {$ibforums->member["id"]} && month = '$month' && year = '$year' order by date_time DESC"); } yourfile.php?mode=showall would show all. This is a really simple thing i suggest reading more tutorials instead of jumping the gun and posting here. Link to comment https://forums.phpfreaks.com/topic/169049-help-with-_get-function-please/#findComment-891971 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.