Newbie search

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi there I'm interested in doing a simple search with mysql and php.. Right
now it finds both of the fields:

SELECT * FROM itltest WHERE jobnum='$jobnum' AND custID='$custID

What I want it to do is to find all custID within the jobnum if the jobnum
is left blank in the field.. Any help would be appreciated!

Re: Newbie search wrote:
Quoted text here. Click to load it

I'm not exactly certain if I understood your question correctly, but
do you mean something like:

  $query = "SELECT * FROM itltest WHERE jobnum='$jobnum'";
  if ( isset( $custID ) && ( $custID === "" ) ) {
    $query .= " AND custID='$custID'";
  // ...and off we go to execute query...

Markku Uttula

Site Timeline