私は学校用のphpファイルに取り組んでいます。フォームを取得し、名前、姓、電子メール、および写真をデータベースに追加する必要があります。名前、電子メールをデータベースに追加できますが、画像名をデータベースに追加できません。これは、php コードの一部と html の一部です。誰かが見て、助けを与えることができる場合。よろしくお願いします。
<?php include("db_connect.php");?>
<?php // select the database in which to add a table
mysql_select_db("final_exam_db",$con);
$sql ="INSERT INTO drivers_0115061 (ln,fn,month,day,year,photo,email)
VALUES ('".$_POST["ln"]."',
'".$_POST["fn"]."',
'".$_POST["month"]."',
'".$_POST["day"]."',
'".$_POST["year"]."',
'".$_POST['file']['photo']."',
'".$_POST["email"]."'
)";
//$sql="INSERT INTO people (fn,ln,dob,city,prov,pc,gender,hc,nod) VALUES ('steve','douglas',1234567,'winnipeg','manitoba','r3p 6g5','m','grey',2)";
//echo $sql;
mysql_query($sql, $con);
echo mysql_error();
?>
<?php include("db_close.php");?>
HTML:
<td>
Picture
</td>
<td>
<input type="hidden" name="MAX_FILE_SIZE" value="10000000"/>
<input type="file" id="photo" name="photo"/>
</td>
</tr>
<tr>
<td>