Jump to content


Photo

Firefox is adding blank row in mysql!!!?????


  • Please log in to reply
3 replies to this topic

#1 dbrimlow

dbrimlow
  • Members
  • PipPipPip
  • Advanced Member
  • 712 posts

Posted 23 January 2006 - 11:20 PM

I have a php form that sets an ID auto increment insert whenever a new row (record) is added by form.

It works fine when submitted via IE.

But, when submitted via FF it adds a blank row to the DB table (along with the correct row) and auto increments them both (ex: id 07 & id 08)!

We scoured the code and could find no reason for it to do this. Then, I noticed, and removed, 2 small unecessary (and improperly used) image placeholders in two <td> tags:

<tr>
<td><img name="placeholder" src="" width="32" height="1" alt="placeholder"></td>
<td width="220"><img src="" width="220" height="1" alt="" style="background-color: #FFFFFF" /></td>

When removed, it properly inserted one incremented row.

How could a static html tag (no matter how poorly entered) dynamically add an insert to a table?

For the static tags, I use validated w3c standard xhtml transitional (which the TD tags obviously didn't conform to).

I don't get it.


Dave

I am always amazed by no matter how much I know, I know I don't know as much as I thought I knew.  - D. Brimlow.

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 24 January 2006 - 07:18 PM

No idea -- that makes no sense at all.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 dbrimlow

dbrimlow
  • Members
  • PipPipPip
  • Advanced Member
  • 712 posts

Posted 25 January 2006 - 06:55 PM

[!--quoteo(post=339511:date=Jan 24 2006, 02:18 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jan 24 2006, 02:18 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
No idea -- that makes no sense at all.
[/quote]

LOL!!!! That's what we've been saying!

Okay, it has to be related to the fact that I am using w3c standard. That's really the only difference between FF and IE that could cause this.

THEREFORE, it MUST be something in the way we are instructing the php to INSERT and auto increment.

Okay. I just created a record and it worked fine. THEN I added the above html back to the table and WHAMMO! Duplicate blank entry!!!! I'm sorry, this is really really weird!

Here is the auto-increment command and the first of the insert commands (7 tables - 7 query inserts):

//get next available id number
$maxquery = "select * from setups order by id asc";
$max_result=mysql_query("$maxquery") or die(mysql_error());
while($result_row=mysql_fetch_array($max_result)) {
$id = $result_row[id];
}
$id++;

//store data into setup table
$query = "insert into setups (id, address, city, state, location, block, lot, bldg_size, land_area, zoning, stories, description2, sale_price, contact, title, exclusive, show_address, form_type) values ('$id', '$address', '$city', '$state', '$location', '$block', '$lot', '$bldg_size', '$land_area', '$zoning', '$stories', '$description2', '$sale_price', '$contact', '$title', '$exclusive', '$show', '$form_type')";
$result=mysql_query("$query") or die(mysql_error());

//store data into photo table
$photo_query = "insert into photo....(I used same format as above for all of the queries)"

//store data into expense table
$expense_query = "insert into expense...

//store data into cost table
$cost_query = "insert into cost ...

//store data into income table
$income_query = "insert into income ...

//store data into date table
$date_query = "insert into date ...

//store data into rent table
$rent_query = "insert into rent...

mysql_close();
?>

Now. Someone tell me how would any subsequent html tag could add a row to the tables?

Dave
Dave

I am always amazed by no matter how much I know, I know I don't know as much as I thought I knew.  - D. Brimlow.

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 25 January 2006 - 10:32 PM

Why are you getting the next UID like that? Seems very strange indeed -- and could cause two records to have UID collisions across different threads. Why do you care what the UID is? Let MySQL handle the auto-increment value on its own.

But I digress -- are you just getting a single extra record in one of the tables, or all seven? And I don't think it has anything to do with w3c at all.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users