php-db | 2000121
Date: 12/05/00
- Next message: Doug Semig: "Re: [PHP-DB] Fw: Creating tables on the fly"
- Previous message: Doug Semig: "Re: [PHP-DB] SQL wildcards???"
- In reply to: Gary: "[PHP-DB] SQL wildcards???"
- Next in thread: Leonard Tambunan: "Re: [PHP-DB] SQL wildcards???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 10:02 PM 5/12/2000, Gary wrote:
>I'm new to PHP, so I have a lot to learn. Is there a way to use any of these
>string comparisons in a SQL statement? Like (select * from database where
>field = "some string comparison") I want to find every instance of a word
>that the user supplies. Are there any wildcard characters I can use?
>
>Thanks, Gary
Im using mysql as a base for my answer, but its definatly do-able.
for example, if I wanted to find every entry that has the color field equal
to 'yellow' I would do a query like
select * from TABLE where color='yellow'
This would select every field from every entry that has the color set to
yellow.
But, if you wanted to have a query where it searches for a word anywhere
within a field entry, (like searching for a street name in a full address
field) then you would....
select * from TABLE where address like '%sunset%'
This would select every field from every entry that has the word 'sunset'
anywhere in the address field.
I hope in not rambling and I dont know whether you are using a different
database, but this is the way I do it in mysql.
--
Chris Aitken - Webmaster/Database Designer - IDEAL Internet
email: chris <email protected> phone: +61 2 4628 8888 fax: +61 2 4628 8890
--------------------------------------------
Unix -- because a computer's a terrible thing to waste!
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Doug Semig: "Re: [PHP-DB] Fw: Creating tables on the fly"
- Previous message: Doug Semig: "Re: [PHP-DB] SQL wildcards???"
- In reply to: Gary: "[PHP-DB] SQL wildcards???"
- Next in thread: Leonard Tambunan: "Re: [PHP-DB] SQL wildcards???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

