Re: Add New Records Only!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



DBF is native dbase databases, used by foxpro etcetera.
But anyhow, I think what you've suggested is what I'll have to do. Take
records from all my mySQL table(s) and put Unique records (based on your
unique identifier exception code) into a temp mySQL table and then simply
transfer the records into the dbase dbf.

Just for your info, I'm using the dbase() functions in php, using
dbase_add_records() to add the records into the dbf.

I'll give this a try, use your code, and more then likely it should work.

Thanks!


On 3/26/07 4:39 PM, "Richard Lynch" <ceo@xxxxxxxxx> wrote:

> I have no idea what DBF is, but if the data is already in MySQL with
> duplicates, you'll need to take everything I just said, and
> "translate" it to DBF.
> 
> If it cannot be translated to DBF because DBF has no unique indeces,
> you could, perhaps, create a TEMP table in MySQL, with the unique
> index, insert rows one by one, and silently ignore the ones that fail
> to insert.
> 
> Then export the temp table to DBF.
> 
> On Mon, March 26, 2007 3:19 pm, Rahul Sitaram Johari wrote:
>> 
>> I'm exporting the data from mySQL table(s) into a dbase DBF table. The
>> unique index you're talking about should be in the DBF end, if I'm not
>> mistaken - but I'm not sure how to do that, and if that will help
>> mySQL to
>> get that error and fail the second insert.
>> 
>> Unless I'm not getting this right.
>> 
>> 
>> On 3/26/07 4:13 PM, "Richard Lynch" <ceo@xxxxxxxxx> wrote:
>> 
>>> On Mon, March 26, 2007 2:28 pm, Rahul Sitaram Johari wrote:
>>>>> Another option would be to just create a UNIQUE INDEX on the
>>>>> fields
>>>>> you think "should" be unique, and then your second insert is gonna
>>>>> fail, and you can just ignore that.
>>>> 
>>>> Could you possibly elaborate on this?
>>>> Things I'm trying are still not working out the way or want to, or
>>>> efficiently. So still looking for a solution.
>>> 
>>> create unique index no_duplicates on whatever(field1, field2,
>>> field3);
>>> 
>>> $query = "insert into whatever (field1, field2, field3)
>>> values('$field1_sql', '$field2_sql', '$field3_sql')";
>>> $insert = mysql_query($query, $connection);
>>> if (!$insert && mysql_errno($connection) == 1062){
>>>   //this is a duplicate insert that failed. do whatever you want
>>> here
>>> }
>>> elseif (!$insert){
>>>   //something else went wrong with the insert.
>>>   //provide usual debugging error handling here
>>> }
>>> else{
>>>   //everything went fine here
>>> }
>>> 
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
>> 
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux