php tutorials, php form validation
Archive Tutorials
Discussion Home
Login / Register

Board List
PHP programming
General

Links
How to save gas 25% or more
Marshall Reddick
Network Marketing Forums
Income Tax Help
Lose 10 Pounds in 3 Weeks
PHP Forum Script
Online Contest

Learn PHP in 47 hours!

Back to PHP programming

Search

php tutorials php tutorials

php tutorials

by foncy on Wed 03/01/2006 12:13 AM

How can I search for specific items in the database and display them in a table

[Reply] [Back to Top]

use LIKE in your mysql query

by uclaboyz on Thu 03/02/2006 01:08 AM

I am assuming you already know how to connect to a database and retrieve the results. 

You can use something like this in your query: 

SELECT * FROM my_table WHERE field LIKE %search_term%; 

What the LIKE %search_term% will do is return all rows where your field matches the search phrase 'search_term', or anything before and after 'search_term'.  That's what the % operator tells mysql to do. 

If you want to search for something that starts with the search phrase, then you would do search_term%, something that ends with the search phrase, then %search_term 

Hope that helps!

[Reply] [Back to Top]

copy of your database scheme

by uclaboyz on Wed 03/22/2006 11:31 PM

copy and paste your database structure here, and what field you want to search.

[Reply] [Back to Top]

© Copyright 2006-2007.  All Rights Reserved. Site hosted by Small Business Web Design
how to start a blog | parenting tips website | Passive Income | baby websites