Re: [PHP-DB] SELECT
Have you considered the GROUP BY statement of SQL?? For example if this is a table's data: msg_iduservarnamevalue 2 1yadahello 3 1yadahows it going? 4 2yadaits me! Zonk! 6 1turmoilanyone here seen that movie before? 8 2turmoiloh yeah, years back! 9 1yadaand that means?? you can: $request_varname="yada"; SELECT * FROM the_table WHERE varname = "$request_varname" GROUP BY user HAVING max(msg_id) If I can recreate my "in brain" SQL engine correctly this sql should work.. I'm not sure of exactly what your setup is like relating to storage of the data, and I'm not certain I understand what you are trying to retrieve with your query either, but I hope I'm heading down the right track.. I'm sure either way that its the GROUP BY predicate you are after.. enjoy!~ ---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- --oOo---oOo-- Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 [EMAIL PROTECTED] www.the-spectrum.org --oOo---oOo-- - Original Message - From: "Ron Piggott (PHP)" <[EMAIL PROTECTED]> To: "PHP DB" Sent: Sunday, December 11, 2005 11:04 AM Subject: [PHP-DB] SELECT I am trying to put together a SELECT syntax. I am querying a response database and I only want to obtain each user's name once even if they have given more than 1 response. $query="SELECT * FROM conversation_table WHERE conversation_reference = $conversation_currently_displayed"; $response_created_by = mysql_result($result,$i,"response_created_by"); My ideal is that if users 1, 2, 4 & 5 are in dialogue with each other the above SELECT $query will only give the results of their identity once with the mysql_request() function Thanks for your help. Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SELECT
Yes, DISTINCT will do the same trick, I wasn't sure though as in the context he placed it I reconsidered DISTINCT and thought of GROUP BY because where there may be multiple entries/rows relating to a shared field they would obviously be seperated by perhaps a unique primary key, timestamp, id of some form, you know what i mean? And most likely obviously this field would be a unique field to the table, or at least to that group of rows.. And again, likely it would be time/date controlled, as in a incremental id number, or timestamp etc.. So in that case he may want the latest row?? Again as I've said in previous email, I'm not really sure what he was wanting to do with the query, did he want a particular row? or any row.. Anyway, thats my 5 cents... ---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- --oOo---oOo-- Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 [EMAIL PROTECTED] www.the-spectrum.org --oOo---oOo-- - Original Message - From: "Philip Hallstrom" <[EMAIL PROTECTED]> To: "Ron Piggott (PHP)" <[EMAIL PROTECTED]> Cc: "PHP DB" Sent: Sunday, December 11, 2005 11:20 AM Subject: Re: [PHP-DB] SELECT I am trying to put together a SELECT syntax. I am querying a response database and I only want to obtain each user's name once even if they have given more than 1 response. $query="SELECT * FROM conversation_table WHERE conversation_reference = $conversation_currently_displayed"; $response_created_by = mysql_result($result,$i,"response_created_by"); My ideal is that if users 1, 2, 4 & 5 are in dialogue with each other the above SELECT $query will only give the results of their identity once with the mysql_request() function SELECT DISTINCT(user_id) FROM conversation_table WHERE conversation_reference = $conversation_currently_displayed should do it. -philip -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SELECT
I am trying to put together a SELECT syntax. I am querying a response database and I only want to obtain each user's name once even if they have given more than 1 response. $query="SELECT * FROM conversation_table WHERE conversation_reference = $conversation_currently_displayed"; $response_created_by = mysql_result($result,$i,"response_created_by"); My ideal is that if users 1, 2, 4 & 5 are in dialogue with each other the above SELECT $query will only give the results of their identity once with the mysql_request() function SELECT DISTINCT(user_id) FROM conversation_table WHERE conversation_reference = $conversation_currently_displayed should do it. -philip -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] SELECT
I am trying to put together a SELECT syntax. I am querying a response database and I only want to obtain each user's name once even if they have given more than 1 response. $query="SELECT * FROM conversation_table WHERE conversation_reference = $conversation_currently_displayed"; $response_created_by = mysql_result($result,$i,"response_created_by"); My ideal is that if users 1, 2, 4 & 5 are in dialogue with each other the above SELECT $query will only give the results of their identity once with the mysql_request() function Thanks for your help. Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Garbage collection (my session files)
I have specified a directory for the session files to be stored in. But by doing so the garbage collection function isn't automatically deleting them. Is there a way I can do so --- Either with a cron or something like this? Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php