나는 회원 테이블과 프로필 이미지 파일의 사진에서 필요한 모든 정보가 지금은 데이터베이스에 프로필 사진 주소를 저장하려면 두 개의 테이블에서 데이터를 표시 할하지만 난 내 PHP 스크립트는 여기mySql 쿼리에 문제가 있습니까?
<?php
error_reporting(E_ALL^E_NOTICE);
include('configdb.php');
if (isset($_POST['submit'])) {
$target_dir = "../Photos/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["file"]["name"]);
if($check !== false) {
echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
}
if (file_exists($target_file)) {
$target_file = $target_dir . rand(1,100000) . basename($_FILES["file"]["name"]);
$uploadOk = 1;
}
if ($_FILES["file"]["size"] > 600000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif") {
echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
$uploadOk = 0;
}
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
} else
if(move_uploaded_file($_FILES["file"]["name"], $$target_dir.$target_file))
{
mysqli_query($conn,"INSERT INTO profileimage VALUES ('','".$target_file."',''") select p.imageid, p.username,p.imagepath from profileimage p
innerjoin member m
on m.username=p.username;
or die(mysqli_error($conn));
}
else {
echo "Sorry, there was an error uploading your file.";
}
}
?>
입니다 오류 있어 (!) : 구문 오류, 예기치 않은 '실리
가 나는 오류 구문 분석 오류가 발생했습니다
mysqli_query($conn,"INSERT INTO profileimage VALUES ('','".$target_file."',''") select p.imageid, p.username,p.imagepath from profileimage p
innerjoin member m
on m.username=p.username;
처럼 내 쿼리를 작성해야 CT '(T_STRING) C에서 : \ WAMP \ WWW 라인 업로드 \ 등록 \의 uploadprofile.php \ 46
난 usernamer가
오류는 무엇입니까? – Epodax
(!) 구문 분석 오류 : 구문 오류, C : \ wamp \ www \ upload \ registration \ uploadprofile.php의 46 번째 줄에있는 예기치 않은 'select'(T_STRING) –
삽입 또는 업데이트 하시겠습니까? – devpro