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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.