我正在创建一个社交网络,并希望用户将他们的个人资料图片上传到 mysql 数据库,并且已经尝试了好几天,但我总是遇到这些错误:
“警告:mysql_query() 期望参数 1 是字符串,第 25 行 /home/gowemtoc/public_html/uploadpic.php 中给出的资源”和“‘字段列表’中的未知列‘数组’”请告诉我有什么问题吗?已经尝试了好几天,找不到什么问题:/这是我的代码
<?php
session_start();
if(isset($_SESSION['myusername'])){
$showusername=$_SESSION['myusername'];}
$showcap = strtolower($showusername);
$mysql_host ="localhost";
$mysql_database="database";
$mysql_user="gowemto_me";
$mysql_password="password";
$usercheck=$_GET['user'];
$link=mysql_connect("$mysql_host","$mysql_user","$mysql_password","mysql_database");
mysql_connect("$mysql_host","$mysql_user","$mysql_password")or die("cannot connect");
mysql_select_db("$mysql_database")or die("cannot select DB");
$result = mysql_query("SELECT * FROM Registered WHERE myusername = '$usercheck'");
if($result === FALSE) {
die(mysql_error());
}
$image = $_FILES['myprofilepicture'];
print_r ($image);
$query=mysql_query("UPDATE Registered set myprofilepicture=$image where myusername='$showusername'");
if (!$result = mysql_query($link, $query)){die('Error occured' .mysql_error($link));}
$id = (int) mysqli_insert_id($link);
exit;
?>