What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » MySQL Query WHERE With Wildcard

MySQL Query WHERE With Wildcard
Author: Message:
leito
Senior Member
****

Avatar
Chameleon by KeyStorm

Posts: 720
Reputation: 5
38 / Male / –
Joined: Apr 2003
O.P. MySQL Query WHERE With Wildcard
Can't get to work the wildcard in this query.

$sql = mysql_query("SELECT * FROM test1 WHERE points='14%'");

And in test1, I have many rows with values like 140, 142, 141, in the points column.

I was reading this tutorial http://www.tizag.com/mysqlTutorial/mysqlwhere.php, and I did exactly what they said there.

This post was edited on 01-09-2005 at 02:41 AM by leito.
[Image: leonelgalan.png]
01-09-2005 02:40 AM
Profile E-Mail PM Find Quote Report
L. Coyote
Senior Member
****

Avatar
Captain Obvious

Posts: 981
Reputation: 49
38 / Male / Flag
Joined: Aug 2004
Status: Away
RE: MySQL Query WHERE With Wildcard
What type of data do you store in points? Int, text?

I think the wild cards worked on text... Can't remember, though...

edit:

I think it should be... WHERE points LIKE '14%'

This post was edited on 01-09-2005 at 02:47 AM by L. Coyote.

Hack, hack, hack!
Finally became a Systems Analyst! :spam:

01-09-2005 02:44 AM
Profile PM Find Quote Report
leito
Senior Member
****

Avatar
Chameleon by KeyStorm

Posts: 720
Reputation: 5
38 / Male / –
Joined: Apr 2003
O.P. RE: MySQL Query WHERE With Wildcard
Thank you for your response, well the type of the column is VARCHAR, and numbers are stored there.
[Image: leonelgalan.png]
01-09-2005 02:46 AM
Profile E-Mail PM Find Quote Report
L. Coyote
Senior Member
****

Avatar
Captain Obvious

Posts: 981
Reputation: 49
38 / Male / Flag
Joined: Aug 2004
Status: Away
RE: MySQL Query WHERE With Wildcard
quote:
Originally posted by leito.gt
Thank you for your response, well the type of the column is VARCHAR, and numbers are stored there.
Read my edit.

To use wildcards you must use LIKE.

column LIKE '%data%'

edit again: I didn't remember this at first :p

This post was edited on 01-09-2005 at 02:50 AM by L. Coyote.

Hack, hack, hack!
Finally became a Systems Analyst! :spam:

01-09-2005 02:50 AM
Profile PM Find Quote Report
leito
Senior Member
****

Avatar
Chameleon by KeyStorm

Posts: 720
Reputation: 5
38 / Male / –
Joined: Apr 2003
O.P. RE: MySQL Query WHERE With Wildcard
Thanks works great!
[Image: leonelgalan.png]
01-09-2005 02:53 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On