Jump to content

hate to bother you one last time tonight... but,...


memphisweb

Recommended Posts

Ok, last bit of code, am trying to eliminate and error trap null fields on a search --- 4 criteria search - image size, opco, campaign, and open searhc to display all results in database

 

 

//handles the variables for image size posting to display all images


if ( $campaign > 0 ) {
$sqlcampaign="campaign_id=$campaign";
}

if ( $opco > 0 ) {
$sqlopco=" company_id=$opco";
}

// handling for 0 search criteria

// no opco or campaign selected
if ( $opco == 0 && $sqlcampaign == 0) {
$bannersearchquerybuild = "WHERE $sqlwidth";

}
// no opco selected
if ( $opco == 0 && $sqlcampaign > 0) {
$bannersearchquerybuild = "WHERE $sqlwidth AND $sqlcampaign";

}
// no campaign selected
if ( $opco > 0 && $sqlcampaign == 0) {
$bannersearchquerybuild = "WHERE $sqlwidth AND $sqlopco";

}

//no image size selected
if ( $imagesize == "0" ) {
$bannersearchquerybuild = "WHERE $sqlcampaign AND $sqlopco";
}

// no opco selected, no campaign, no size
if ( $opco == 0 && $sqlcampaign == 0 && $sqlwidth ==0) {
$bannersearchquery = " SELECT file_set.* FROM file_set";

}
else
{
$bannersearchquerybuild= "$sqlwidth AND $sqlcampaign AND $sqlopco";
$bannersearchquery = "SELECT file_set.* FROM file_set  WHERE $bannersearchquerybuild";
}

 

just having a bear of a time trapping out if one has an empty vallue

 

 

Thanks again for help

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.