Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
PHP
<?php
$tot="total+1";
$s=$_POST['a'];
require('connect.php');
global $pdo;
foreach($s as $value)
{
$stmt=$pdo->prepare("INSERT INTO atten (total) VALUES(:a) where roll=?");
$stmt->bindParam(':a',$tot);
$stmt->bindParam(1,$value);
$stmt->execute();
}
if($stmt==null)
{	
die("error".print_r($stmt->errorinfo()));
}
else
{
print_r($stmt);
echo"your attendence sucessfully update";
}
$pdo=null; 
?>
please help to insert data into database
Posted
Updated 29-Dec-13 6:13am
v2
Comments
Mohibur Rashid 29-Dec-13 20:43pm    
You have where condition in INSERT Query. It is suppose to make error
Peter Leow 31-Dec-13 7:12am    
Could you provide more explanation on what you want to achieve with your script. Besides syntax errors, there are also some doubts on the logic. One of them is the use of where in insert sql. Could it be an update sql? What is $tot and $a? Please use the "Improve question" button.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900