Code: Select all
if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) {
include('SimpleImage.php');
$image = new SimpleImage();
$image->load($_FILES['image']['tmp_name']);
$image->resize(128, 128);
$image->save('avatar.jpg');
$fp = fopen("avatar.jpg", 'r');
$data = fread($fp, filesize("avatar.jpg"));
$data = addslashes($data);
fclose($fp);
$query = "UPDATE users SET ";
$query .= "icon='$data' WHERE username='$uname'";
$results = mysql_query($query, $link);
if($results) {
header('location: desktop.php');
exit();
I am uing a connect.php file that handles connecting to the database and selecting the right table, and that is working right, because it is usedon every other pge and shows properly. Please someone help me out on this one, I can't see where the error is.Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in avatarupload.php on line 82