Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Help with calling data from mysql
Old 04-02-2005, 05:53 AM Help with calling data from mysql
Sonic's Avatar
Skilled Talker

Posts: 64
Trades: 0
Can I use a wildcard type phrase to call data from a table?

I want to just pull out all titles that begin with the first letter, I can display it if I have another table that just has a letter in so it would be something like

??.php?category=a

but I would prefer to use

??.php?title=a

but this will only display it if the title is 'A' and not 'a?? ??? ?????'

hope you I've made myself undderstud
__________________

Please login or register to view this content. Registration is FREE
Sonic is offline
Reply With Quote
View Public Profile Visit Sonic's homepage!
 
 
Register now for full access!
Old 04-02-2005, 07:50 AM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Code:
SELECT * FROM mytable WHERE title LIKE 'A%'
I believe that LIKE is case sensitive. Alternatively you can use Regular Expressions.

Code:
SELECT * FROM mytable WHERE title REGEXP BINARY '^A'
The BINARY keyword tells the expression to be case sensitive.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 04-02-2005, 08:16 AM
Sonic's Avatar
Skilled Talker

Posts: 64
Trades: 0
Works a treat, thanks


Edit:

Hmm sorry did work fine until I added B now it selects a & b
__________________

Please login or register to view this content. Registration is FREE

Last edited by Sonic; 04-02-2005 at 08:19 AM..
Sonic is offline
Reply With Quote
View Public Profile Visit Sonic's homepage!
 
Old 04-02-2005, 11:38 AM
Sonic's Avatar
Skilled Talker

Posts: 64
Trades: 0
Got it sorted I used

Code:
SELECT * FROM mytable WHERE `title` LIKE '$sort%'";
And just use ??.php?sort=a or ??.php?sort=b etc

Thanks for the help
__________________

Please login or register to view this content. Registration is FREE
Sonic is offline
Reply With Quote
View Public Profile Visit Sonic's homepage!
 
Reply     « Reply to Help with calling data from mysql
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.60619 seconds with 12 queries