如何在mysql数据库中插入查询? [英] how to pdo insert query in mysql database ?

查看:162
本文介绍了如何在mysql数据库中插入查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <?php  
$ tot = total + 1;
$ s = $ _ POST [' a'];
require(' connect.php');
global $ pdo ;
foreach($ s as $ value)
{
$ stmt = $ pdo-> prepare( INSERT INTO注意(总计)VALUES(:a)其中roll =?);
$ stmt-> bindParam(' :a',$ tot);
$ stmt-> bindParam(1,$ value);
$ stmt-> execute();
}
if($ stmt == null)
{
die( 错误 .print_r($ stmt-> ERRORINFO()));
}
else
{
print_r($ stmt);
echo 您的注意力成功更新< /跨度>;
}
$ pdo = null;
?>

请帮助将数据插入数据库

解决方案

< blockquote> tot = total + 1;


s =


_POST [' a'];
require(' connect.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

解决方案

tot="total+1";


s=


_POST['a']; require('connect.php'); global


这篇关于如何在mysql数据库中插入查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆