Page 1 of 1

another question =( Resource id #14 error

Posted: Fri Feb 16, 2007 3:16 am
by psychotomus
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #14' at line 1

Code: Select all

$conn=mysql_connect($dbhost, $dbuser, $dbpass);
	mysql_select_db($dbname) or die ('Could not connect: ' . mysql_error());
	
	$query="SELECT * FROM t_banners ORDER BY RAND() LIMIT 1";	
	$qresult= mysql_query($query) or die(mysql_error());
	$line = mysql_fetch_assoc(mysql_query($qresult)); // <--- error is here
	
	echo $line['code'];

Posted: Fri Feb 16, 2007 6:11 am
by volka
  1. there's no question in your text.
  2. $qresult= mysql_query($query) or die(mysql_error());
    $line = mysql_fetch_assoc(mysql_query($qresult)); // <--- error is here
    why's there another mysql_query?

Posted: Fri Feb 16, 2007 6:17 am
by psychotomus
OMG. cant believe i missed that. guess thats what i get for pulling all nighter! thanks.