mysql-link error message
Posted: Thu May 26, 2011 7:46 pm
I have the following code, that when run,should take a file that has been uploaded, resize it, save it, then open it up as data and add it to a blob in the db but I keep getting an error. The cod I have is...
$uname is set as $uname = $_SESSION['username']; I can echo out $uname and it shows the correct username but I keep getting the following error...
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