Thanks for the note, I will determine if this applies to our situation.
However I believe I found the solution to my problems to be apache related.
I found that after upgrading to apache 1.3.20, MANY of our web server
requests were duplicated & some times tripled when using IE 5.5 (and
presumably others, but not telnetting straight to port 80).  This meant that
the page would be loaded twice per actual request.  This was a problem
evident in the apache access_log (2 page executions per "refresh") whether
or not I hit the database (so possibly related to php but not to database
(sybase) connectivity/functionality).  I did not test this with non-php
pages.  This problem immediately went away when going back to apache 1.3.9
which is where we were at before upgrading to php4.  Apache support states
it is not a bug with apache, but with IE & hasn't done anything about it.

As for the mention below, I don't see the original code you're referencing,
but I don't see why that would run twice.  The first statement places the
return value of the mysql_query command into the variable
$res_insert_campaign -- NOT the entire "executable command" of
mysql_query($sql,$conn).  If later one evaluates that variable (if
!$res_insert_campaign), there is no possibility it would re-run that
command, since $res_insert_campaign, is a SCALAR VARIABLE, not something
which knows anything about your mysql_query call.  I think the double-row
insertion problems people are experiencing are due to the double-running of
each php command due to this odd apache issue.

Thanks,
Rob.
  -----Original Message-----
  From: Sebastiaan J.A. Kamp [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, July 04, 2001 6:21 AM
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: Re: Insert queries add TWO records to database


  It's more of a PHP than a MySQL 'problem' & certainly not a MySQL bug,
but...

  Upon processing "$res_insert_campaign=mysql_query($sql,$conn);" the script
will insert a line into your database.
  Then, upon evaluating "if (!$res_insert_campaign) {" it will do "if
(!mysql_query($sql,$conn))" and insert another line...

  Try being less 'indirect' about what you want:

  $sql = "INSERT INTO Campaign

(CampaignName,CampaignDesc,StartDate,EndDate,CompanyId,CampaignStatus,Admini
stratorId) VALUES
  ('$name','$desc','$start_date','$end_date',$company_id,0,1)";

  if (!mysql_query($sql,$conn);) {
    return false;
  }


  Regards,

  Sebastiaan J.A. Kamp

  Operating system: WinNT4
  PHP version:      4.0.6
  PHP Bug Type:     MySQL related
  Bug description:  Insert queries add TWO records to database

  All my insert queries seem to add two records to the database instead of
  one.

  I was using MS Access 2000 and did not have the problem. I am now using
  MySQL and all insert queries add 2 recs?!

  [...CUT...]

  A guy in the US seems to be having the same problem with Sybase.  His
  details are:

  Rob Donat
  Sedonatech, Inc.
  1735 W. Diversey Suite 521
  Chicago, IL 60614
  [EMAIL PROTECTED]
  312-501-1200 cell
  773-388-0271(2) office(fax)




Reply via email to