Multiple criteria search using php


#1

Hello guys, Please, I need help concerning a multiple criteria search form using php. Can somebody help me out here.
Please see attach file (.png) to see how the search criteria form is


#2

How come there is no one to help with this issue?


#3

There doesn’t appear to be any attachment on this thread.


#4

@takinbo: I can’t attach any of the php pages here so that is why I did a screen shot of the search page. I do not mind sending it directly to you


#5

I have attached the file and the sql here. The format for the search is that you can use any of the search parameters or combine more than one for your search.

Trust You guys will help


#6

@adeleke06 from what I can tell from this, you want to search CVs, however, I can’t find a CVs table in the SQL export. Can you provide the format for the CVs table?


#7

@takinbo: thank you for your response, the CVs table is the application table in the sql


#8

So Mr @adele06 i hope the problem as has been solved. Still need help?


#9

Oga Nimboya am still on it, the one I had is looking good thanks to @dojoVader but can I get yours maybe it will fit in but I tell you dojoVader did somthing wonderful


#10

This is realy way back but I jst wish I was here then to help.
But leme give a quick solution, might still help some one.

A string builder will fix this.


$conn = new mysqli(…); // put ur connection parameters

$sql = "SELECT * FROM cv WHERE 1=1;
if($exp1 != “” && $exp2 != “”) $sql .= "AND experience BETWEEN $exp1 AND $exp2;
if($indu) $sql .= "AND industry = ‘$indu’ ";
if($edu_lev) $sql .= "AND education_level = ‘$edu_lev’ ";
if($lang) $sql .= "AND language = ‘$lang’ ";

$sql .= “ORDER BY id ASC”;
$conn->query($sql);

I didn’t use the names from ur attachment but I believe u get d concept here.
So if each input response from the user in not empty, it will append the corresponding query to the sql string otherwise it will skip it.
You can improve on that for beta results.