Re: [PHP] Comparing data - big file
דניאל דנון wrote: As continuation to my last question, I got another one. a brief summary: I had to process a file that contains 700,000 lines, each line contained some data (lets assume each line was like: name|age|work|lastaccessed) age contains the person's age in time() format, how many seconds has past since he was born. lastaccessed contains also a time(), with his last access. work is some text, also is name. ) so I inserted it (with stacked queries), My question is - lets assume I get a new file, and I need to compare the changes - how would you suggest me to do it? diff. I also don't have the old file. Recreate it? /Per -- Per Jessen, Zürich (18.8°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Comparing Data
-Original Message- From: Justin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 14 August 2002 10:52 AM To: [EMAIL PROTECTED] Subject: [PHP] Comparing Data Hello all, I've run into a problem and there has got to be a way to do this. I'm searching a mysql table and finding all rows that have the same ID. I need to output that ID, but I only want it to print once. Any help would be greatly appreciated! Justin what about something like a simple select statement eg SELECT * FROM table where id = $ID; then do something like echo $ID echo $other values. blah blah blah blah with the echo in a loop so it gets all the values.. just a thought.. Cheers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Comparing Data
Well, the only problem is, the data will be outputted into a dropdown box, so a loop would cause duplicates of the ID. Guess I should have mentioned that there are approx 50 ID's and they are not unique. The only way I can think of doing it is something like: $foo = mysql_query($whatever) while ( mysql_fetch_row($foo) ) { if ( $id == 1 ) { $id1_count ++; } if ($id == 2) { $id2_count ++; } } if ($id1_count =1) { print This ID; } But something like that on a larger table will cause problems with server load after time (I'm assuming)... Any other possibilities out there? Thanks again. Justin At 11:17 AM 8/14/2002 +1000, you wrote: -Original Message- From: Justin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 14 August 2002 10:52 AM To: [EMAIL PROTECTED] Subject: [PHP] Comparing Data Hello all, I've run into a problem and there has got to be a way to do this. I'm searching a mysql table and finding all rows that have the same ID. I need to output that ID, but I only want it to print once. Any help would be greatly appreciated! Justin what about something like a simple select statement eg SELECT * FROM table where id = $ID; then do something like echo $ID echo $other values. blah blah blah blah with the echo in a loop so it gets all the values.. just a thought.. Cheers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing Data
On Tue, 13 Aug 2002 21:31:22 -0400, you wrote: Well, the only problem is, the data will be outputted into a dropdown box, so a loop would cause duplicates of the ID. Guess I should have mentioned that there are approx 50 ID's and they are not unique. The only way I can think of doing it is something like: [...] Any other possibilities out there? Are you just looking for duplicate ID's? If so, put the work on the SQL server, not PHP: select id,count(*) as cnt from table group by id having cnt 1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php