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 |
+---------+------------+------------+------------+-------------+-------------+---------------+
|