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
:  [EMAIL PROTECTED]
:  ABN: 64 235 749 494
:  QUT Student #: 04475739
:::::::::::::::::::::::::::::::::::::::::::
  ----- Original Message ----- 
  From: [EMAIL PROTECTED] 
  To: [EMAIL PROTECTED] 
  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
  [EMAIL PROTECTED]
  www.tececo.com





------------------------------------------------------------------------------


  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to