Jump to content

INSERT code writing in my DB twice


mcmuney

Recommended Posts

I'm using the code below to insert data into my DB, but it's executing twice. Not as a duplicate, but with it's own unique line. How can I fix this?

	if($ft>0)
		{
			$ft="UPDATE sc_member SET mem_feature_flag='1' WHERE scm_mem_id='$ft'";
			$res=$db->update($ft);
			
			// SEND MESSAGE
   			$time=time();
   			$ft=$_GET['ft'];
   			$txt_sb_body="Hey ".$fname.", You have been featured! Keep up your activity! {automated message}";
   			$sql="INSERT INTO sc_messages (`smg_from`, `smg_to`, `smg_subject`, `smg_body`, `smg_sent_del`, `smg_postdate`, `scm_bulletin`, `send_cron`) VALUES ('1','$ft','Featured Alert','$txt_sb_body','1','$time', '6', 'N')";
   			$result = mysql_query($sql);				
		}		
Link to comment
Share on other sites

What happens if you try to comment the $result variable?

$sql="INSERT INTO sc_messages (`smg_from`, `smg_to`, `smg_subject`, `smg_body`, `smg_sent_del`, `smg_postdate`, `scm_bulletin`, `send_cron`) VALUES ('1','$ft','Featured Alert','$txt_sb_body','1','$time', '6', 'N')";
  
//$result = mysql_query($sql);
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.