List:General Discussion« Previous MessageNext Message »
From:Reindl Harald Date:April 15 2011 4:41pm
Subject:Re: Out of sync tables
View as plain text  

Am 15.04.2011 18:34, schrieb Gary:
> Michael
> 
> I'm sorry, I should have removed this code for the post, but this code is 
> part of a "honey pot".  There is no 'address' input visible, it is used so 
> if a spam bot enters information into this field, it kills the form.  Humans 
> cannot enter anything into this field.

but why somewhere middle in the code instead making
clean verifications at the begin?

> ""Again, I see no reason you could not call last_insert_id() after the
> first insert and use that value explicitly in the second.
> ""
> 
> I'm not sure I undertand this, could you explain a little further for me

<?php
 mysql_query("insert into table1 (field1, field2) values ('value1', 'value2')", $conn);
 $id = mysql_insert_id($conn);
 mysql_query("insert into table2 (ref_id, data) values (" . $id . ", 'yourdata')", $conn);
?>

as long you never use the insert-id from the AI i wonder how
there could be anything out of sync because there never can
be anything in sync



Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Thread
Out of sync tablesGary15 Apr
  • Re: Out of sync tablesMichael Dykman15 Apr
  • Re: Out of sync tablesGary15 Apr
    • Re: Out of sync tablesReindl Harald15 Apr
      • Re: Out of sync tablesMichael Dykman15 Apr
  • Re: Out of sync tablesGary15 Apr
    • Re: Out of sync tablesReindl Harald15 Apr
    • Re: Out of sync tablesJohan De Meersman15 Apr
  • Re: Out of sync tablesGary15 Apr
    • Re: Out of sync tablesReindl Harald15 Apr
  • Re: Out of sync tablesGary15 Apr