Jump to content

Duplicate Updates


kamal213

Recommended Posts

You've made over 60 posts so your not that new, also you agreed to the Rules when you created your account. I was giving you advice and so in a way trying to help you, but OK, some more direct help for you then:

Forum Rules

 

Failure to comply with any of the following rules is breach of contract and as such, administrators and moderators can take appropriate action as they see fit. If there is any contradiction between the Terms of Service and these rules, the Terms of Service shall take precedence.

 

 


  •    
  • All users must read and agree to the PHP Freaks Terms of Service found above before creating an account.
       
  • All users must be courteous to others.
       
  • All users are strongly encourage to abide by the Forum Guidelines.
       
  • All users acknowledge that PHP Freaks Administration have ultimate control over topics that a user posts.
       
  • Advertising and Spam are not allowed and is under a zero-tolerance ban/removal from PHP Freaks Forums.
       
  • Any sticky topic posted at the top of a forum can be considered a rule if the contents merit as such.
       
  • Signatures may contain textual links to your website(s) as long as it is not overdone/distracting to users.
       
  • Any adult material (18+) is NOT allowed in the forums. If your posts contain links to such material, remove the links before posting.
       
  • Any content posted that is hereby deemed Illegal or makes references to illegal content is hereby prohibited, will be deleted and action may be taken against the user who posts such materials.
       
  • By no means will any staff member change a user's account name or delete a user account. So do not ask.
       
  • Flaming and or Trolling is prohibited and will result in course of action to be taken by Staff members.
       
  • All request for code to be written for you should be posted under the freelance section. No exceptions.
       
  • Duplication of topics is strictly prohibited. Users will not post duplicate topics, if a topic needs moved please use the "Report to Moderator" button and a staff member will move the topic as soon as possible.
       
  • Users will not act as though they are staff members, and users will not judge other users' behavior. If you believe a user is breaking the rules or Terms of Service, please contact a member of staff using either the "Report to moderator" link found at the bottom of each post, or by sending them a PM (Private Message).
       
  • Users are allowed to have one account only. Creating multiple accounts per person may result in having all of them banned.
       
  • Users are not allowed to contact members or staff members with the intention of receiving help with subjects covered in any boards.
       
  • Users should not "bump" topics that are still on the first page of the forums. If you bump, you must provide additional information. If you resort to bumping, chances are your question needs to be re-thought and re-described (see Eric Raymond's "How To Ask Questions The Smart Way").
  • Private disputes must be handled privately. Do not use one of the public forums for this.

 

And you still need to provide more information about what it is you are trying to do, to what, and what data is already there if any, for you to get the help that you are looking for.

Link to comment
Share on other sites

I havent been here long enough to know all the rules you have listed Muddy_Funster..you obviously have that why you do.

 

I did what I did because I wanted the perspective of someone good with PHP and someone good with SQL..i simple copied n paste to save time obviously the mistake - Again I wasnt aware of the rules.. I know now.

 

The code below checks to see if there is a duplicate sales record for a customer when inserting into the table and if there is it redirect to an error page. I want to know if you can do the same for when you are updating a table.

 

	// See if that customers sale has already been recorded
$sql = mysql_query("SELECT * FROM salesrecord WHERE customer ='$customer' AND value='$value ");
$customerMatch = mysql_num_rows($sql); // count the output amount
    if ($customerMatch > 0) {
	while($row = mysql_fetch_array($sql)){
	$customer = $row["customer"]
		 header("location: sale_error.php?id=$c_id");
	exit();
}
}

Link to comment
Share on other sites

I havent been here long enough to know all the rules you have listed Muddy_Funster..you obviously have that why you do.

 

I did what I did because I wanted the perspective of someone good with PHP and someone good with SQL..i simple copied n paste to save time obviously the mistake - Again I wasnt away of the rules.. I know now.

 

You read and agreed to the rules when you signed up.

 

The code below checks to see if there is a duplicate sales record for a customer when inserting into the table. I want to know if you can do the same for when you are updating a table.

Of course you can, though the code you have posted doesn't make a great deal of sense.

Link to comment
Share on other sites

@ thorpe :- I was, as was stated previously, simply proffering advice - at no time did I elude to being a member of the forum staff, or atempt to influence an opinion to that nature, I felt that the OP should be aware of the rules.  I then so thought to save the OP the trouble of looking these rulles up and included them in thread for their perusal.  I do not generaly feel that there is sufficient cause to report an individual for every flaunting of the rules, when normaly an infomative comment is sufficient.  If there is something specific that you would like to draw to my attention that has not been covered here in then do please PM me, I was not intending to cause any problems.

 

@kamal213 :- You would run a select on the fields that you want to update, and then compare any result set information that is returned (that which you get back from the database SELECT query) with the variables that you are looking to use in the update.  If it is an exact match then you can then decline to run the update.

Link to comment
Share on other sites

Muddy_Funster you are a genius problem solved!

 

And agian I wasnt aware of the rules coz I didnt read them properly when I joined..am sure am not the only one tho, its like term and conditions not everyone reads all 2/3pages.

 

I should have read the rules, I broke the rules and apologies to you and every1 in PHP Freaks including the staff. If you look at my POST you'll find I dont usually break rules and am not here to make trouble simply get advise.

 

My problem is solved and again apologies for the confusion i cause u or any1 before thing get outta hand.

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.