Jump to content

kerukelw

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kerukelw's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you for the welcome! I tried on SQL, it works.. it actually works without the join and the on. somehow on the $types[] = isset($_GET['sname'])?"`icno` LIKE '%{$searchTermDB1}%'":''; when i try using jsprofile.icno instead of icno, it doesnt work This is how my table looks like JSPROFILE icno (primary) name gender address MEDI icno status comments
  2. hi I have a problem with a multiple table simple sql search. I made it such that it can search on two tables. but it came out as a blank instead. I tried without the " INNER JOIN medi On jsprofile.icno = medi.icno " and it works fine! if (count($error) < 1) { $searchSQL = "SELECT * FROM jsprofile INNER JOIN medi On jsprofile.icno = medi.icno WHERE "; // grab the search types. $types = array(); $types[] = isset($_GET['sicno'])?"`name` LIKE '%{$searchTermDB}%'":''; $types[] = isset($_GET['sname'])?"`icno` LIKE '%{$searchTermDB1}%'":''; $types[] = isset($_GET['sgender'])?"`gender` LIKE '%{$searchTermDB2}%'":''; $types = array_filter($types, "removeEmpty"); // removes any item that was empty (not checked) if (count($types) < 1) $types[] = "`jsprofile.icno` LIKE '%{$searchTermDB}%'"; // use the body as a default search if none are checked $andOr = isset($_GET['matchall'])?'AND':'AND'; $searchSQL .= implode(" {$andOr} ", $types) . " ORDER BY `icno`"; // order by title. $searchResult = mysql_query($searchSQL) or trigger_error("There was an error.<br/>" . mysql_error() . "<br />SQL Was: {$searchSQL}");
×
×
  • 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.