error in my SQL query

  • Thread starter Thread starter Anonymous
  • Start date Start date
A

Anonymous

Guest
:(



i wanna do this request on my table:

SELECT id from authuser where last like $last

the var $last exist and contain a value....
on phpmyadmin this request works
but in my php script i has this error....

Warning: Supplied argument is not a valid MySQL result resource

i knw that my var is a string and i wonder if its not my prob...cuz i knw that with a integer its ok no prob..i've done it and it wirks....

pls help me...

ps:php, apache and mysql are really good and seems to b soo powerfull i am learning everyday and its soo good.....
 
try placing " around you're string, like this:
Code:
select id from authuser where last like "searchtext"

Greetz
 
dvdbinternet said:
try placing " around you're string, like this:
Code:
select id from authuser where last like "searchtext"

Greetz

but i thought that the " were used when u have a define string....
but here its not..
the content of my string depend of the content of a texfield insite a form....
so i dont think dat i can use this trics...

thx for ur reply
tra
 
:?........

i think i found the tric somewhere in this forum ......

thx guys.

tra
 
cho@ said:
but i thought that the " were used when u have a define string....
but here its not..
the content of my string depend of the content of a texfield insite a form....
so i dont think dat i can use this trics...

thx for ur reply
tra
Seems self-explanatory to me :D

You have to use quotes whenever you use a string. The only time you can get away without using them is just numbers (or reference to a table field).
 
Back
Top