Jump to content

[SOLVED] IF inside query


tj71587

Recommended Posts

You can keep adding to the query like this:

 

<?php 

$query = "SELECT * FROM tablem WHERE 1=1";

if(conditon){
  $query .= " AND blah='$blah'"
}

if(conditon){
   $query .= " AND whatever='$whatever'"
}

?>

 

Is that what your trying to do?

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.