Link to home
Start Free TrialLog in
Avatar of axessJosh
axessJosh

asked on

PHP MySQL not inserting data into database

I am trying to insert multiple rows of data into my DB.  My script appears to be working, showing me the confirmations on my page, but nothing gets inserted into the DB.  I setup a var_dump() and it shows the first row correctly.  Any help is appreciated.

 
// insert values to the DB here 

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$count=mysql_num_rows($rsDesAcct);
$acctID = $_POST['acctID'];
$amount = $_POST['amount'];
$desclID = $_POST['acctgrpID'];
for($i=0; $i<$count; $i++){
mysql_select_db($database_con_portal_test, $con_portal_test);
  $SQL = "INSERT INTO tbldepbrk (depBrkAmnt, depBrkDate, depDesAcctID, depBrkClientID ) VALUES ('$amount[$i]' , '$_POST[date]' , '$acctID[$i]' , '$desclID')";
   
   if (!$SQL)
  {
  echo ('Error: ' . mysql_error($con_portal_test));
  }
}}
?>

Open in new window


 
// if your email succesfully sent
if(isset($_POST['submit1'])) {
if($SQL){
echo "Your Deposit Has Been Added - <a href='bookkeeping_depositenter.php'> Add Another</a>";
var_dump($SQL); 
} }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of axessJosh
axessJosh

ASKER

Thanks Guys.

I had it working on another page before I transferred it to a new page.  Guess I should have cut and pasted the statement instead of re-writing.