Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search Parameter ?

Status
Not open for further replies.

fxcolin

Technical User
Oct 14, 2001
169
CA
I'm pretty new to MySQL.
I recently installed php, MySQL, Apache on my PC. I'm also working with Dreamweaver Ultradev 4 and Phakt.

On my search page, I have 1 text box and 1 dropdown box.
When I submit the form if I leave the text box empty, it seems to pull the whole database. Also I have a similar problem with multiple pages. I have next and previous pages set up. I only have 4 records at the moment. I have set it so that only 2 records appear on the page. If I enter a search that pulls 3 records it will say found 2 of 3 records. When I click 'next', it will say 3 of 4 records, with the 4th. record being totally unrelated.

I think this is because when I click 'next' the text box becomes empty.

Can someone help with a suggestion, maybe an IF statement ??

Thanks alot.
 
Hi Dumtech,

Here's what it looks like in the Recordset of Phakt
SQL:
SELECT *
FROM recipes INNER JOIN recipes_author USING (aid)
WHERE ingredients LIKE '%MMColParam%' OR ingredients2 LIKE '%MMColParam%' OR recipes.type LIKE '%MMColParam1%'

Variables:
Name Default Value Run Time Value
MMColParam % $HTTP_POST_VARS["word"]
MMColParam1 % $HTTP_POST_VARS["type"]

Basically I'm trying to pull from 2 tables 'recipes' and 'recipes_authors' where both contain 'aid'
MMColParam ("word") is the text field
MMColParam1 ("type") is the drop down

Incidently, if I choose from the dropdown and put something in the other text field, I will get records, but if I leave the text field empty, I get the whole database.

Is this enough info?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top