Jump to content

Duplicate Entries


mcmuney

Recommended Posts

I'm using the code below to delete a line and after delete, it's running the //insert coin system function. The problem is that after it deletes the record, the coin system function is being duplicated (being written twice), any reason why it's doing that? It's should only write once:

[code]
<?

$id=$_GET['id'];

$sci_id=$_GET['sci_id'];



if($id!=="" && $sci_id!="")

{

$del_msg="delete from sc_postcomment where id=$id";

$del_rs=$db->delete_data($del_msg);

if($del_rs>0)
{
//-------------------------- Insert into COINS system --------------------------------

$post_photo_comment = 6;

// select $friend_request category

$sql = "SELECT * FROM sc_coins_type WHERE id = $post_photo_comment";

$c_t =$db->select_data($sql);



if($c_t[0][disable]!=1)

{

$sql_coins1 = "UPDATE sc_member set coins_sum=coins_sum -".$c_t[0][price]." where scm_mem_id = $social_mem_id";

$db->update_data($sql_coins1);





$time_=time();

$sql_c = "INSERT INTO sc_coins_asset (`type_id`,`mem_id`,`from/to_mem_id`,`date_added`,`value`) VALUES($post_photo_comment,$social_mem_id,$scm_mem_id,'".$time_."',-".$c_t[0][price].")";

$db->insert_data($sql_c);

}

//echo $sql_c;

//exit();

//----------------------------------------------------------------------------------//
}



//header("location:social_mem_see_mess.php?sci_id=$sci_id&scm_mem_id=$social_mem_id");

}



?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/26633-duplicate-entries/
Share on other sites

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.