> > > > > php codes [search.php] > _____________________________________________ > mysql_connect (host, username, password); > > mysql_select_db("db") or die("Unable to select database"); > > $query = "SELECT * FROM parts WHERE make LIKE '$q' || > model LIKE '$q' || part_name LIKE '$q' || year_from LIKE '$q' > || year_to LIKE '$q'"; > > > while ($row= mysql_fetch_array($result)) { > $make = $row["make"]; > $model = $row["model"]; > $part_name=$row["part_name"]; > $year_from = $row["year_from"]; > $year_to = $row["year_to"]; > $quantity=$row["quantity"]; > > echo "$row["model"]
"; > ... > ... > ?> > _____________________________________________ > > > so far, i have been able to ONLY get just by year, or make, > or model, or part name, but not a combination. to make > matters a bit more complex i am trying to find parts by typing: > > "94 civic" --------> 94 is not inventory but is between > year_from and year_to > > i should get two results, and print them out. i haven tried > more than couple ways but so far have not achieved my goal. > > also, i can't figure out how to get results that fall between > the years_from and year_to. > > ie. > > 93 95 > 92 97 > 92 96 > > find 94.. > > thanks in advance for you help. > > sincerely, > Moses ">??
?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


?
?searching help !!





php codes [search.php]
_____________________________________________
mysql_connect (host, username, password);

mysql_select_db("db") or die("Unable to select database");

$query = "SELECT * FROM parts WHERE make LIKE '$q' ||
model LIKE '$q' || part_name LIKE '$q' || year_from LIKE '$q' || year_to LIKE '$q'";


while ($row= mysql_fetch_array($result)) {
$make = $row["make"];
$model = $row["model"];
$part_name=$row["part_name"];
$year_from = $row["year_from"];
$year_to = $row["year_to"];
$quantity=$row["quantity"];

echo "$row["model"]
";
...
...
?>
_____________________________________________


so far, i have been able to ONLY get just by year, or make, or model, or part name, but not a combination. to make matters a bit more complex i am trying to find parts by typing:

"94 civic" --------> 94 is not inventory but is between year_from and year_to

i should get two results, and print them out. i haven tried more than couple ways but so far have not achieved my goal.

also, i can't figure out how to get results that fall between the years_from and year_to.

ie.

93 95
92 97
92 96

find 94..

thanks in advance for you help.

sincerely,
Moses

Author:??(---.sympatico.ca)
Date:???07-26-04 20:47

hi,
i am trying to search a database with car parts info in it. The user types a part name with year he/she gets the expected results. sounds simple, but i am having problems. here is how everything is put together [abstract].

mysql
_____________________________________________
year_from | year_to | make | model | part_name
98 | 04 | honda | civic | COVER PRIMED FRONT
92 | 95 | honda | civic | fender
93 | 96 | honda | civic | engine


the form
_____________________________________________

?Topics Author? Date
?searching help !!??new
Moses 07-26-04 20:47?
?Re: searching help !!??new
bastien 07-27-04 12:15?
?Re: searching help !!??new
Moses 07-28-04 10:50?
?Re: searching help !!??new
bastien 07-28-04 11:38?
?Re: searching help !!??new
Moses 07-29-04 09:59?
?Re: searching help !!??new
bastien 07-29-04 11:53?
?Re: searching help !!??new
Moses 07-30-04 14:27?
Go to Top??|??Go to Topic??|??Flat View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??wrote: > > hi, > i am trying to search a database with car parts info in it. > The user types a part name with year he/she gets the expected > results. sounds simple, but i am having problems. here is how > everything is put together [abstract]. > > mysql > _____________________________________________ > year_from | year_to | make | model | part_name > 98 | 04 | honda | civic | COVER > PRIMED FRONT > 92 | 95 | honda | civic | fender > 93 | 96 | honda | civic | engine > > > the form > _____________________________________________ >
>

Provided By
Phorum