General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 27th, 2004, 12:08 PM
LSUTiger LSUTiger is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 LSUTiger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Duplicate Rows Inserted

New to the forum and this question could really span multiple sections. I have been having problems with a form which inserts rows into a mySQL database table. Initially, the form appeared to be submitting the information twice (only one click on the submit button) resulting in two rows of the same information being inserted into the table. I remedied this by removing <form> tags from around a "Close" button I had included in the "action" script because all it did was close a spawned window. Basically all the action script did was check the valued entered and either displayed an error message or displayed a success message and then inserted ONE row of information into the table. Removing the form tags from around the close button solved this problem. Weird but nonetheless it worked.

I am now faced with similar problem. The code below results in two rows being inserted ...

if ($_POST['osqrate']) {

$osqrate = $_POST['osqrate'];
$osqid = $_POST['osqid'];

if ($uid) {
$tuid = $uid;
} else {
$tuid = $_SERVER['REMOTE_ADDR'];
}
$db = connect2db();
// Add user's rating
$sql = "insert into ratings (rid,qid,uid,rating) values (NULL,$osqid,'$tuid',$osqrate)";
$query = mysql_query($sql);
echo mysql_error();
}

Two php scripts are included for the udf connect2db() and various other functions/classes but that is the only code that executes relative to the table in the db. I am getting two rows. I have searched and searched but have found no information on others experiencing this same problem. A reference to a similar post, if there is one, is appreciated or guidance on what may be going awry.

TIA

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Duplicate Rows Inserted


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT