delete duplicates from array and insert statement
| From: | Ryan A | Date: | Sat, 17 Sep 2005 21:28:41 +0000 |
| Subject: | delete duplicates from array and insert statement | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-222577@lists.php.net to get a copy of this message | ||
Hi,
I have a movie database with this structure:
flick_name text
part_url text
part_size varchar(50)
time_length varchar(50)
part_format varchar(10)
and my select statement is something like this:
insert into table values
("abba",http://...abba1.wmv,"3
mb","3
mins",".wmv"),("abba",http://...abba2.wmv,"3 mb","3
mins",".wmv")
and so on.
When we get new movies we get the whole sql to insert it....but the problem
is it contains all the movies we already have too
eg:
in the db we already have the album
but we get the abba album and the new movies in this kind of format
("abba",http://...abba1.wmv,"3
mb","3
mins",".wmv"),("abba",http://...abba2.wmv,"3 mb","3
mins",".wmv"),("Led
Zep",http://...led_zep1.wmv,"4
mb","2 mins",".wmv") etc etc
want i want to do is, do a select and get the data that is already in the
db, compare it, and if its in the insert statement delete those rows...
am getting screwed up in the logic for this...so far I have exploaded the
insert statement so its in a neat array, now i need to check in_array...
I have not written much code so i didnt include the code here, but if you
need it just reply to me.
Any ideas?
Thanks,
Ryan