每当我尝试将视频存储到数据库中时,它都会给我一个错误。我这里有一个代码可以将视频存储到一个文件夹中,并且只保存数据库中的 id_no 和 video_name,我希望将所有 5 个字段都存储到我的数据库中。 ..任何人都可以帮我解决我的代码吗
<?php session_start();?>
<?php
include("session/DBConnection.php");
include("session/session.php");
$error = "";
?>
<?php
$user = $_SESSION['log']['username'];
$query = mysql_query("SELECT * FROM members WHERE username = '$user'") or die (mysql_error());
$display = mysql_fetch_array($query);
if(isset($_POST['upload'])){
$mem_id = $display['member_id'];
$stat = "just uploaded a video.";
$date = date("m/d/Y");
$qry = "INSERT INTO updates SET member_id='$mem_id', status='$stat', date='$date'";
$result = mysql_query($qry);
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=video.php\">";
}
}
?>
<?php
if(isset($_POST['video']) && $_FILES['userfile']['size'] > 0)
{
$tmpName = $_FILES['userfile']['tmp_name'];
$fp = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}
else{
move_uploaded_file($_FILES["userfile"]["tmp_name"],"video_uplaod/" . $_FILES["userfile"]["name"]);
$user = $_SESSION['log']['username'];
$today = strtotime(date("Y-m-d H:i:s"));
$location="video_upload/" . $_FILES["userfile"]["name"];
$video_name=$_POST['video_name'];
$sql = "INSERT INTO tbl_video SET username='$user', video='$location', video_name='$image_name', date_created='$today'";
echo "File $fileName uploaded";
}
header("video.php");
?>