Page 1 of 1

MySQL Query --- Warning...

Posted: Thu Nov 16, 2006 8:57 pm
by tecktalkcm0391
How come this code always gives me
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/i4boredo/public_html/uploadimgs.php on line 13

Code: Select all

//starts line 11
$new = mysql_query("INSERT INTO `pictures` (userid) VALUES  (".$userid.")");
$get = mysql_query("SELECT * FROM `pictures` WHERE `userid`=". $userid ." ORDER BY `pictureid` LIMIT 1 DESC");
$nextfile = mysql_fetch_array($get);
$nextfile = $nexfile['pictureid'];
$filename = $nextfile;
$filename_s = $filename.'_s'; 
$filename_m = $filename.'_m';

Posted: Thu Nov 16, 2006 9:17 pm
by tecktalkcm0391
Ok I got it to stop doing that... now using

Code: Select all

$new = mysql_query("INSERT INTO `pictures` (`userid`) VALUES  (".$userid.")");
$get = mysql_query("SELECT `pictureid` FROM `pictures` WHERE `userid` = '". $userid ."' ORDER BY `pictureid` DESC LIMIT 1");
if(!$get){
print("NO");
echo"<br>";
}
$nextfile = mysql_fetch_array($get);
$file = $nextfile['pictureid'];
$filename = $file;
$filename_s = ''.$filename.'_s'; 
$filename_m = ''.$filename.'_m';

// ****
print_r($nextfile);
echo"<br>";
print($file);
echo"<br>";
print($filename);
echo"<br>";
print($filename_s);

die();
And nothing is coming up at all for any of the items that are printed out....only the echos. and "_s" for the $filename_s


Why????

Posted: Thu Nov 16, 2006 9:27 pm
by aaronhall

Code: Select all

$new = mysql_query("INSERT INTO `pictures` (`userid`) VALUES  (".$userid.")");
You never inserted a picture ID, just the user ID

Posted: Thu Nov 16, 2006 9:33 pm
by tecktalkcm0391
thnks i got it now.