![]() |
![]() |
![]() |
||||
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. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Jan 2001
Location: Montreal
Posts: 1,830
|
![]() Hey there...
I am trying to figure out the best way to do this... right now, I do one query where I gather the info needed to build the page... basically, it returns 4 rows, and with each mysql_fetch_row, I build a html table to display an update... (example, it would build the page listing girl1, girl2, girl3, girl4 with her info such as description, name, etc...) NOW, I need to test each of these girls against ANOTHER table in mysql database. Unfortunately, I cannot combine the field of that table directly in the same table as the original one, since it's totally different data... it would basically be a simple query like SELECT update_info.girl,surfer_behavior.clicks FROM update_info left join surfer_behavior on update_info.girl = surfer_behavior.girl; But, if I split the queries like that, I would have to run the last query 4 times for each girl inside the loop that builds the page, as I need to include that data in order to build the one girl's table... (basically, I would test if surfer_behavior.clicks < 100, don;t display 'congrats') What I am wondering is if there's any way you MYSQL gurus might know for me to Sort of JOIN these two queries together with the first one... in other words, how do I add this to the original query : "and if votes.clicks >100 for current girl in this row, add a column named 'test' that says true" ![]()
__________________
![]() Stunner Media Programs: StandAhead | IndieBucks | BoyCrushCash | Phoenixxx | EmoProfits | BritishBucks | HunkMoney | LatinoBucks Make $$$ with Gay! Lowest Minimum Payouts in the Business, Perfect Track Record, Amazing Sites |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
salad tossing sig guy
Join Date: Apr 2002
Location: mrthumbs*gmail.com
Posts: 11,702
|
store the results of each query in a differect array
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Jan 2001
Location: Montreal
Posts: 1,830
|
I edited my post, basically for the second part I need to do a left join and test if it's null, or bigger than something...
--- mr thumbs, I know how I could do it doing 5 queries on the page.... I'm trying to find out if there's a way I could combine it all in one....
__________________
![]() Stunner Media Programs: StandAhead | IndieBucks | BoyCrushCash | Phoenixxx | EmoProfits | BritishBucks | HunkMoney | LatinoBucks Make $$$ with Gay! Lowest Minimum Payouts in the Business, Perfect Track Record, Amazing Sites |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 | |
Confirmed User
Industry Role:
Join Date: Jan 2002
Posts: 7,981
|
Quote:
SELECT ...... WHERE row IS NULL OR row > 100 |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: Jan 2001
Location: Montreal
Posts: 1,830
|
LOL, I'm not clear at all it seems...
is there any Mysql gurus I could reach on ICQ? that'd be WAY easier to explain what I want to do there heheh if anyone feel helpful tonite, let me know by all means ;)
__________________
![]() Stunner Media Programs: StandAhead | IndieBucks | BoyCrushCash | Phoenixxx | EmoProfits | BritishBucks | HunkMoney | LatinoBucks Make $$$ with Gay! Lowest Minimum Payouts in the Business, Perfect Track Record, Amazing Sites |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Join Date: Oct 2002
Location: Where the hell am I now?
Posts: 153
|
mag: what would help us in telling you what your query should be would be to post the output of "explain table" for both tables you need to get data from, tell us which data you need to get out, and under which condition. Then we'll be able to write a simple query string that will perform that
![]()
__________________
The wiseman owns little but knows much, while the fool knows little but owns much |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Join Date: Jan 2001
Location: Montreal
Posts: 1,830
|
ok, this isn't clear at all... I'll go and fetch some data, will be easier to explain with the real stuff instead of fictional stuff
__________________
![]() Stunner Media Programs: StandAhead | IndieBucks | BoyCrushCash | Phoenixxx | EmoProfits | BritishBucks | HunkMoney | LatinoBucks Make $$$ with Gay! Lowest Minimum Payouts in the Business, Perfect Track Record, Amazing Sites |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | |
Will code for food...
Join Date: Apr 2001
Location: Buckeye, AZ
Posts: 8,496
|
Quote:
you can get all the data with a single query.. like this: select update_info.girl, update_info.blah, update_info.huh, update_info.something, surfer_behavior.clicks ..... etc..
__________________
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
So Fucking Banned
Join Date: Aug 2003
Location: San Diego, CA
Posts: 5,464
|
I'm not to clear on your question phil... ICQ me tomorrow and i'll help you out.
What I got from your post.. I think your best bet would be to run the first query and put all the data into an array. While looping through the results of the second query you could check whatever variables you need to from the other array. Using the in_array function or something similar. Not sure if that made any sense so hit me up tomorrow. Gonna grab a beer and watch some quality tv. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Industry Role:
Join Date: Oct 2002
Location: lalaland
Posts: 2,120
|
Hm, add another LEFT JOIN?
SELECT UI.girl as girl,SB.clicks as surferclicks,V.clicks as voteclicks FROM update_info as UI LEFT JOIN surfer_behavior as SB on UI.girl = SB.girl LEFT JOIN votes as V on V.girl = SB.girl; .. something like that maybe? edited for typo. Hm, maybe the "as" things just confused... SELECT update_info.girl as girl,surfer_behavior.clicks as surferclicks,votes.clicks as voteclicks FROM update_info LEFT JOIN surfer_behavior on update_info.girl = surfer_behavior.girl LEFT JOIN votes on votes.girl = surfer_behavior.girl;
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
Join Date: Feb 2003
Location: Canby, OR
Posts: 7,453
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Confirmed User
Join Date: Jan 2001
Location: Montreal
Posts: 1,830
|
ok, I was totally unclear there ;)
I have put live examples in here, that should be much clearer... re-edited the message cuz this wasn't clear at all... putting the real queries and some sample data in... here's the main query... SELECT update_info.code, update_info.collection, update_info.short_name, UNIX_TIMESTAMP(update_info.date_start) AS date_start, update_info.total_votes, update_info.total_score FROM update_info WHERE date_start < now( ) ORDER BY date_start DESC LIMIT 2 , 2; basically, it returns 2 rows in this example... +---------+------------+------------+------------+-------------+-------------+ | code | collection | short_name | date_start | total_votes | total_score | +---------+------------+------------+------------+-------------+-------------+ | anna01 | hardcore | Anna T | 1064373796 | 0 | 0 | | jenny01 | blowjob | Jenny J | 1064286997 | 0 | 0 | +---------+------------+------------+------------+-------------+-------------+ now, I also need to run 2 other queries to see if an ip matches... mysql> SELECT votes.code,votes.ip_address -> FROM votes -> WHERE code='jenny01' AND ip_address='24.201.235.105'; +---------+----------------+ | code | ip_address | +---------+----------------+ | jenny01 | 24.201.235.105 | +---------+----------------+ 1 row in set (0.00 sec) AND mysql> SELECT votes.code,votes.ip_address -> FROM votes -> WHERE code='anna01' AND ip_address='24.201.235.105'; Empty set (0.00 sec) That has to be done WHILE I'm building the page from the earlier mysql_query... (as it gets the codes to check for inside that query) is there a way I could add another column to the first query returned, testing if there is an IP Match using the code of that row? for example, it would return something like +---------+------------+------------+------------+-------------+-------------+---------------+ | code | collection | short_name | date_start | total_votes | total_score | Test | +---------+------------+------------+------------+-------------+-------------+---------------+ | anna01 | hardcore | Anna T | 1064373796 | 0 | 0 |24.201.235.105 | | jenny01 | blowjob | Jenny J | 1064286997 | 0 | 0 |NULL | +---------+------------+------------+------------+-------------+-------------+---------------+
__________________
![]() Stunner Media Programs: StandAhead | IndieBucks | BoyCrushCash | Phoenixxx | EmoProfits | BritishBucks | HunkMoney | LatinoBucks Make $$$ with Gay! Lowest Minimum Payouts in the Business, Perfect Track Record, Amazing Sites |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Confirmed User
Industry Role:
Join Date: Oct 2002
Location: lalaland
Posts: 2,120
|
Uhm ...
... LEFT JOIN votes ON votes.code = update_info.code ... ? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 |
Confirmed User
Industry Role:
Join Date: Oct 2002
Location: lalaland
Posts: 2,120
|
SELECT update_info.code, update_info.collection, update_info.short_name, UNIX_TIMESTAMP(update_info.date_start) AS date_start, update_info.total_votes, update_info.total_score,votes.ip_address as Test
FROM update_info LEFT JOIN votes ON votes.code = update_info.code . . bla bla |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 | |
Confirmed User
Join Date: Jan 2001
Location: Montreal
Posts: 1,830
|
Quote:
but, it's more than that... if there's 3 surfers that would vote, then it'll have jenny01 | 111.111.111.111 jenny01 | 125.125.125.125 jenny01 | 142.142.142.142 see what I mean?
__________________
![]() Stunner Media Programs: StandAhead | IndieBucks | BoyCrushCash | Phoenixxx | EmoProfits | BritishBucks | HunkMoney | LatinoBucks Make $$$ with Gay! Lowest Minimum Payouts in the Business, Perfect Track Record, Amazing Sites |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#16 |
Confirmed User
Industry Role:
Join Date: Jun 2003
Location: Silicon Valley
Posts: 317
|
I assumed you are getting the ip to check from your program not from mysql
SELECT u.code, u.collection, u.short_name, UNIX_TIMESTAMP(u.date_start) AS date_start, u.total_votes, u.total_score, v.code, v.ip_address FROM update_info u, votes v WHERE u.date_start < now( ) AND u.code = v.code AND v.ip_address = '$IP' ORDER BY u.date_start DESC |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#17 | |
Confirmed User
Join Date: Oct 2002
Location: Where the hell am I now?
Posts: 153
|
Quote:
seems about right to me ![]() would give the following query: SELECT update_info.code, update_info.collection, update_info.short_name, UNIX_TIMESTAMP(update_info.date_start) AS date_start, update_info.total_votes, update_info.total_score, votes.ip_address FROM update_info LEFT JOIN votes ON votes.code = update_info.code WHERE date_start < now( ) ORDER BY date_start DESC LIMIT 2 , 2;
__________________
The wiseman owns little but knows much, while the fool knows little but owns much |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#18 | |
Confirmed User
Join Date: Oct 2002
Location: Where the hell am I now?
Posts: 153
|
Quote:
SELECT update_info.code, update_info.collection, update_info.short_name, UNIX_TIMESTAMP(update_info.date_start) AS date_start, update_info.total_votes, update_info.total_score, votes.ip_address FROM update_info LEFT JOIN votes ON votes.code = update_info.code WHERE date_start < now( ) AND votes.ip_address = '24.201.235.105' ORDER BY date_start DESC LIMIT 2 , 2;
__________________
The wiseman owns little but knows much, while the fool knows little but owns much |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#19 | |
Confirmed User
Join Date: Jan 2001
Location: Montreal
Posts: 1,830
|
Quote:
yep... but the problem here is, it checks IF ANYONE Clicked. Not IF SURFER Clicked... see what I mean? I am surfer with Ip : 24.201.235.105... I have clicked on one of them, BUT, with that left join, I get these results... +---------+------------+------------+------------+-------------+-------------+----------------+ | code | collection | short_name | date_start | total_votes | total_score | Test | +---------+------------+------------+------------+-------------+-------------+----------------+ | anna01 | hardcore | Anna T | 1064373796 | 0 | 0 | NULL | | jenny01 | blowjob | Jenny J | 1064286997 | 0 | 0 | 11.111.111.222 | +---------+------------+------------+------------+-------------+-------------+----------------+ not my ip, cuz I was the 2nd surfer to click on that link, not the first (the left join picked the first one it saw) I'd have to specify on the left join that the IP must be 24.201.235.105, or return null
__________________
![]() Stunner Media Programs: StandAhead | IndieBucks | BoyCrushCash | Phoenixxx | EmoProfits | BritishBucks | HunkMoney | LatinoBucks Make $$$ with Gay! Lowest Minimum Payouts in the Business, Perfect Track Record, Amazing Sites |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#20 | |
Confirmed User
Join Date: Oct 2002
Location: Where the hell am I now?
Posts: 153
|
Quote:
__________________
The wiseman owns little but knows much, while the fool knows little but owns much |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#21 |
Confirmed User
Join Date: Oct 2002
Location: Where the hell am I now?
Posts: 153
|
although this might solve your problem:
SELECT update_info.code, update_info.collection, update_info.short_name, UNIX_TIMESTAMP(update_info.date_start) AS date_start, update_info.total_votes, update_info.total_score, votes.ip_address FROM update_info LEFT JOIN votes ON votes.code = update_info.code AND votes.ip_address = '24.201.235.105' WHERE date_start < now( ) ORDER BY date_start DESC LIMIT 2 , 2; try this on your mysql and tell me if it works...
__________________
The wiseman owns little but knows much, while the fool knows little but owns much |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#22 | |
Confirmed User
Join Date: Jan 2001
Location: Montreal
Posts: 1,830
|
Quote:
NICE, that's what I wanted to do, exactly ;) +---------+------------+------------+------------+-------------+-------------+----------------+ | code | collection | short_name | date_start | total_votes | total_score | ip_address | +---------+------------+------------+------------+-------------+-------------+----------------+ | anna01 | hardcore | Anna T | 1064373796 | 0 | 0 | NULL | | jenny01 | blowjob | Jenny J | 1064286997 | 0 | 0 | 24.201.235.105 | +---------+------------+------------+------------+-------------+-------------+----------------+ 2 rows in set (0.00 sec)
__________________
![]() Stunner Media Programs: StandAhead | IndieBucks | BoyCrushCash | Phoenixxx | EmoProfits | BritishBucks | HunkMoney | LatinoBucks Make $$$ with Gay! Lowest Minimum Payouts in the Business, Perfect Track Record, Amazing Sites |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#23 | |
Confirmed User
Join Date: Oct 2002
Location: Where the hell am I now?
Posts: 153
|
Quote:
__________________
The wiseman owns little but knows much, while the fool knows little but owns much |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#24 |
Confirmed User
Join Date: Jan 2001
Location: Montreal
Posts: 1,830
|
I knew there was some GURU in there ;)
__________________
![]() Stunner Media Programs: StandAhead | IndieBucks | BoyCrushCash | Phoenixxx | EmoProfits | BritishBucks | HunkMoney | LatinoBucks Make $$$ with Gay! Lowest Minimum Payouts in the Business, Perfect Track Record, Amazing Sites |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#25 | |
Confirmed User
Join Date: Jan 2001
Location: Montreal
Posts: 1,830
|
Quote:
__________________
![]() Stunner Media Programs: StandAhead | IndieBucks | BoyCrushCash | Phoenixxx | EmoProfits | BritishBucks | HunkMoney | LatinoBucks Make $$$ with Gay! Lowest Minimum Payouts in the Business, Perfect Track Record, Amazing Sites |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#26 |
Confirmed User
Join Date: Oct 2002
Location: Where the hell am I now?
Posts: 153
|
quebecois
![]() tu viendras nous voir sur bizadulte.com ![]()
__________________
The wiseman owns little but knows much, while the fool knows little but owns much |
![]() |
![]() ![]() ![]() ![]() ![]() |