Re: (newbi)mySQL query question
| From: | The_RadiX | Date: | Sat, 18 May 2002 14:04:57 +0000 |
| Subject: | Re: (newbi)mySQL query question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98256@lists.php.net to get a copy of this message | ||
try this:
$query = "SELECT code FROM links WHERE sort_text LIKE '$letter%'";
Note there are now single quotes (') identifying the string of the LIKE operator and also the
assignment operator (=) has been replaced with the proper LIKE mySQL operator that allows for string
search arguments.
:::::::::::::::::::::::::::::::::::::::::::
: Julien Bonastre [The-Spectrum.org CEO]
: A.K.A. The_RadiX
: the_radix@hotkey.net.au
: ABN: 64 235 749 494
: QUT Student #: 04475739
:::::::::::::::::::::::::::::::::::::::::::
----- Original Message -----
From: webmaster@tececo.com
To: php-general@lists.php.net
Sent: Saturday, May 18, 2002 11:27 PM
Subject: [PHP] (newbi)mySQL query question
This doesn't have a huge amount to do with PHP but,
I have the following code for my SQL query:
$query = "SELECT code FROM links WHERE sort_text = $letter*";
I get an error.
What I want to do is be able to specify a letter and have the rest be undefined eg
if $letter was t
I would get TecEco, Tiny, and Trailer
and if $letter was b I would get Basket and Ball.
Could any one show me the correct syntax off their heads?JJ Harrison
webmaster@tececo.com
www.tececo.com
------------------------------------------------------------------------------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php