Jump to content

Not inserting into DB


Recommended Posts

The below isn't inserting the credits into the database. The credit entries are not duplicates. So the IGNORE in the INSERT shouldn't be the issue correct? I attempted to insert Test, Test2

 

elseif($_GET['do']="process"){
$source=sanitize($_GET['source']);
$name=sanitize($_POST['name']);
$email=sanitize($_POST['email']);
$amount=amount_verify(sanitize($_POST['amount']));
$username=sanitize($_POST['username']);
$level=sanitize($_POST['level']);
$password=kam3($_POST['password']);
$admin=sanitize($_POST['user_level']);
$credits=sanitize($_POST['credit']);

if($amount=="00"){
$amount="";
}

if($_GET['source']=="new"){
$add_user_query="INSERT INTO $tbl_name (username, name, level, amount, password, admin, email) VALUES ('$username', '$name', '$level', '$amount', '$password', '$admin', '$email')";
mysql_query($add_user_query);
if(!empty($credit)){
$insert_id=mysql_insert_id();
$CreditArray = array();
foreach($credits as $credit){
$CreditArray[] = "('$credit','$insert_id')";
}
if (count($CreditArray) > 0 ) {
$credit_array_query="INSERT IGNORE INTO $tbl_name2 (credit,donor_id) VALUES " . implode(',',$CreditArray);
mysql_query($credit_array_query);
}
}

}
elseif($_GET['source']=="edit"){

}

}

Link to comment
https://forums.phpfreaks.com/topic/241525-not-inserting-into-db/
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.