another question =( Resource id #14 error

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

another question =( Resource id #14 error

Post 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'];
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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?
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Post by psychotomus »

OMG. cant believe i missed that. guess thats what i get for pulling all nighter! thanks.
Post Reply