![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
|
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Industry Role:
Join Date: May 2002
Location: Brentwood,TN Heredia, Costa Rica
Posts: 320
|
PHP Question
I have the following function
PHP Code:
This prints each category everytime its listed in the db I cant use select distinct because some categories contain more than one category : example anal, amateur, blowjob |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#2 | |
Registered User
Join Date: Nov 2005
Posts: 28
|
This should work for ya:
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#3 |
Registered User
Join Date: Nov 2005
Posts: 28
|
That's what I get for posting this early in the morning, I didn't read it ;)
You need to separate that out so its not in the same field like that. You could also read through all of them explode them by the commas and unique that array. |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: Nov 2004
Location: The Netherlands
Posts: 573
|
well your problem is bad database design ;) basically what ferrishyn said....his solution will work too....but it's better to start at the source and build up your database the right way
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Industry Role:
Join Date: May 2002
Location: Brentwood,TN Heredia, Costa Rica
Posts: 320
|
Yea the database design is from an affiliate dump, they dump the categories seperated by commas.
|
![]() |
![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Industry Role:
Join Date: Aug 2005
Location: Costa Rica
Posts: 465
|
yo, a quick hack to get your stuff working...
note: that select statement gives the impression that the categories are already stored in the database as one category per row, but i guess not. PHP Code:
__________________
-- "You can't stop ingenuity, trust me.." ![]() |
![]() |
![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Industry Role:
Join Date: Aug 2005
Location: Costa Rica
Posts: 465
|
update:
replace ($category) in the echo statement to ($element) which holds the category. peace
__________________
-- "You can't stop ingenuity, trust me.." ![]() |
![]() |
![]() ![]() ![]() ![]() |