By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,747 Members | 2,011 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,747 IT Pros & Developers. It's quick & easy.

Select from table where field = string

P: n/a
How to select all lines containg a string (located in $pastmove) in the
moves column

I tried several ways, for example:

$requete="SELECT moves, opening_id FROM suitemove where moves like
'%".$pastmove."%'";

but did not succeed;

Thqnks for your help
Jul 16 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
> $requete="SELECT moves, opening_id FROM suitemove where moves like
'%".$pastmove."%'";

try `` insted ''.

yours, dreamguard.
Jul 16 '05 #2

P: n/a
what do you mean by "insted" ?
Jul 16 '05 #3

P: n/a
I tried this

$requete="SELECT moves, opening_id FROM suitemove where moves like
'%".$pastm."%'";

The whole table, i.e. all rows are selected, not only the ones with the
content of $pastm in moves column

Jul 16 '05 #4

P: n/a
Michel wrote:
How to select all lines containg a string (located in $pastmove) in the
moves column

I tried several ways, for example:

$requete="SELECT moves, opening_id FROM suitemove where moves like
'%".$pastmove."%'";

but did not succeed;
I can't see anything at all wrong with this. If it is selecting _all_
records as your later post suggests, then check to see if there is a
value in $pastmove. If $pastmove is empty then:
...WHERE moves LIKE '%%'
will select everything.
Thqnks for your help


--
MeerKat

Jul 16 '05 #5

P: n/a

On 24-Aug-2003, "Michel" <Mi**************@wanadoo.fr> wrote:
How to select all lines containg a string (located in $pastmove) in the
moves column

I tried several ways, for example:

$requete="SELECT moves, opening_id FROM suitemove where moves like
'%".$pastmove."%'";

but did not succeed;


Your select statement looks correct.

Can you be more specific-- how did it not succeed?

Did the query fail? What was the error message? (You are reporting the error
messages, right?)
If the query worked, did it return the wrong rows? too many rows, etc.

Are you sure your table definition is correct and the column names are
spelled correctly? Are you sure $pastmove contains a value?
--
Tom Thackrey
www.creative-light.com
Jul 16 '05 #6

P: n/a
Michel wrote:
I tried this

$requete="SELECT moves, opening_id FROM suitemove where moves like
'%".$pastm."%'";
$pastm or $pastmove?
The whole table, i.e. all rows are selected, not only the ones with the
content of $pastm in moves column


--
MeerKat

Jul 16 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.