Jump to content

Help with $_GET function please!!


Gayner

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.