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
mysql field type SET to PHP
Old 06-15-2009, 08:37 AM mysql field type SET to PHP
Super Talker

Posts: 134
Trades: 0
if i have a mysql table with a column with type SET and values x, y,z and a want a listing from all rows where this column has the values x and z, how do i do this in php

thanks in advance
__________________

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

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-15-2009, 11:12 AM Re: mysql field type SET to PHP
Extreme Talker

Posts: 181
Name: David Jackson
Trades: 0
The SQL is...

Code:
SELECT * FROM table WHERE field IN('x','z')
This does not explain how to do this in PHP and is a much bigger question

How much PHP do you know?

Does the SQL above mean anything to you?
__________________

Please login or register to view this content. Registration is FREE
davidj is offline
Reply With Quote
View Public Profile
 
Old 06-15-2009, 01:54 PM Re: mysql field type SET to PHP
Super Talker

Posts: 134
Trades: 0
you code doesn't work

i tried it phpmyadmin
__________________

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

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
Old 06-15-2009, 02:55 PM Re: mysql field type SET to PHP
Extreme Talker

Posts: 181
Name: David Jackson
Trades: 0
you did change the SQL to reflect your own database / tables / fields didnt you?
__________________

Please login or register to view this content. Registration is FREE
davidj is offline
Reply With Quote
View Public Profile
 
Old 06-16-2009, 04:07 AM Re: mysql field type SET to PHP
Super Talker

Posts: 134
Trades: 0
of course

otherwise it would return an error
__________________

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

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
Old 06-16-2009, 05:49 AM Re: mysql field type SET to PHP
Super Talker

Posts: 134
Trades: 0
i think i figured out the right mysql code

Code:
SELECT * FROM table WHERE field & 5 = 5;
it is a kind of complicated

x values 1, y values 2 and z values 4

a combination of x an z gives you 5 (1+4)

where field = 5 finds all rows with the combination x and z

where field = &5 = 5 finds all rows with the combination x and z and other possible values (in this example y)
__________________

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

Check out the Facebook Clone build with Jcow SNS at
Please login or register to view this content. Registration is FREE
, it is free and it always will be
Falcone is offline
Reply With Quote
View Public Profile
 
Old 06-16-2009, 06:19 AM Re: mysql field type SET to PHP
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Ahhh, bitmasking....
My own very nightmare....
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to mysql field type SET to PHP
 

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.18144 seconds with 12 queries