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
https://forums.phpfreaks.com/topic/285077-insert-code-writing-in-my-db-twice/
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);

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.