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 [ CEO]
:  A.K.A. The_RadiX
:  ABN: 64 235 749 494
:  QUT Student #: 04475739
  ----- Original Message ----- 
  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


  PHP General Mailing List (
  To unsubscribe, visit:

Reply via email to