![]() |
|
? |
![]() PHP FAQ PHP Articles PHP Help Bulletin Board PHP Manual (NEW!) First Time PHP'ers Help with programming Sql assignment help PHP Homework Help
|
? |
|
|||||||||||||||||||||||||||||||||||||||||||||
?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 > _____________________________________________ > | > > > > > 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"]