The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
mysql_fetch_array() error
ok i am getting an error after having this query on my index
this is the error Code:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /forums/admin/db_mysql.php on line 154 this is the query Code:
$newestsql=$DB_site->query("SELECT * FROM gal_Object where Freigabe='y' order by newat desc limit 1"); while($newObject=$DB_site->fetch_array($newestsql)) { $getnewthumb=$DB_site->query_first("SELECT * FROM gal_Pictures where Object='$newObject[ID]' ORDER BY rand() DESC LIMIT 1"); // get a random pic $tmpnew=explode(".",$getnewthumb[filename]); $newthumbfilename="gt_".$tmpnew[0].".jpg"; eval( '$newestsql = "' . gettemplate( 'home_newest' ) . '";' ); } this is line 154 Code:
$this->record = mysql_fetch_array($this->query_id); |
#2
|
|||
|
|||
Try...
LIMIT 0,1 That's the only thing that jumps out to me. |
#3
|
||||
|
||||
Your only fetching one row, hence you should be using query_first and remove the while loop.
|
#4
|
||||
|
||||
ok so im now trying
Code:
$newestsql=$DB_site->query_first("SELECT * FROM gal_Object where Freigabe='y' order by newat desc limit 0,1"); { $getnewthumb=$DB_site->query_first("SELECT * FROM gal_Pictures where Object='$newObject[ID]' ORDER BY rand() DESC LIMIT 1"); // get a random pic $tmpnew=explode(".",$getnewthumb[filename]); $newthumbfilename="gt_".$tmpnew[0].".jpg"; eval( '$newestsql = "' . gettemplate( 'home_newest' ) . '";' ); } if i remove the { i get a Parse error |
#5
|
||||
|
||||
Neither of the {} are needed as far as I can see with that code segment.
|
#6
|
|||
|
|||
I see Limits which are not needed on query_first.
I see an array element with no single quotes around it. I see order by rand, but rand() will not equate to a field name, just a number. |
#7
|
|||
|
|||
Also, a side note: never, ever query in a loop
|
#9
|
||||
|
||||
Its not stricly needed, but heres what he means:
PHP Code:
|
#10
|
||||
|
||||
@ Call to undefined function: mysql_fetch_array()
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|