<?php

try{
$dsn='mysql:host=localhost;dbname=feifei';
$pdo=new PDO($dsn,'root','root');
$pdo->exec("SET NAMES utf8");
//准备预处理对象
$stmt=$pdo->prepare("INSERT INTO AVideo(id,name,content) VALUES(?,?,?)");
//绑定参数
$stmt->bindParam(1,$id,PDO::PARAM_INT);
$stmt->bindParam(2,$name,PDO::PARAM_STR);
$stmt->bindParam(3,$content,PDO::PARAM_LOB);
//为变量赋值
$id=1;
$name='小清新';
$content=file_get_contents('222222222222.wmv');
//执行操作
$stmt->execute();
//判断执行结果
if($stmt->rowCount()){
echo '小清新插入成功';
}else{
echo '悲剧了~~~';
}
}catch(PDOException $e){
echo $e->getMessage();
}


?>

相关文章:

  • 2022-12-23
  • 2022-01-29
  • 2021-04-18
  • 2021-09-19
  • 2022-01-10
  • 2021-12-04
  • 2021-06-19
猜你喜欢
  • 2022-12-23
  • 2021-06-10
  • 2021-07-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案