作者:围脖上的博博_771 | 2023-09-10 07:57
尝试使用php将用户网络摄像头生成的图像插入mysql数据库,但它不起作用.我正在使用webcam.js,一切正常.当用户拍摄快照时,图像存储在服务器上,但是,mysql插件不执行插入作业.知道为什么它不工作?
两个代码如下所示:
cam.php:
session_start();
include_once 'dbconnect.php';//connection to db
if(!isset($_SESSION['user'])){//ensures that it the true user
header("Location: index.php");
}
//display current time
//$arrival_time= date('Y-m-d H-i-s');
//echo "$arrival_time";
if (isset($_POST['send'])) {
$getname= mysql_real_escape_string($_POST['last_name']);
$idvalue= $_SESSION['myvalue'];
$update=mysql_query("UPDATE `employees`.`webcam_clockin`
SET `last_name`='$getname' WHERE image_id='$idvalue'");
if($update)
{
//run a check to verify last_name
$sql=mysql_query("SELECT users.*, employees.* FROM users
NATURAL JOIN employees
WHERE employees.last_name='$getname'");
$result=mysql_fetch_array($sql);
if($result){
$_SESSION['user'] = $result['user_id'];
header("Location: home.php");
}
else
{
?>