I am creating a social network and want users to upload their profile pictures to mysql database, and have been trying for days but I always get these errors:
"Warning: mysql_query() expects parameter 1 to be string, resource given in /home/gowemtoc/public_html/uploadpic.php on line 25" and "Unknown column 'Array' in 'field list'" please tell me whats wrong I've been trying for days and can't find whats wrong :/ here is my code
<?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;
?>