PDA

View Full Version : why won't this thing select?!


N!ck
11-07-2002, 11:55 AM
$nowplaying=$DB_site->fetch_array($DB_site->query_first("SELECT * FROM nowplaying WHERE userid = '".$bbuserinfo[userid]."' ORDER BY dateline DESC LIMIT 1"));
$nptext = "\"".$nowplaying[song]."\"-".$nowplaying[artist];


i've got it in global.php just above the part that fetches the header template, but when i put $nptext in the template, it just shows up as ""- rather than "<Song Title>"-<Artist>

any ideas?

Xenon
11-07-2002, 01:38 PM
because $DB_site->fetch_array just works with db result arrays, but queryfirst doesn't return such an array.

use this:
$nowplaying=$DB_site->query_first("SELECT * FROM nowplaying WHERE userid = '".$bbuserinfo[userid]."' ORDER BY dateline DESC LIMIT 1");
$nptext = "\"".$nowplaying[song]."\"-".$nowplaying[artist];

N!ck
11-07-2002, 09:01 PM
still won't work :(

Xenon
11-07-2002, 09:16 PM
well, the query is correct..
be sure the infos are in the DB

and that you don't use $nptext within a function, or if so make it globalized

N!ck
11-07-2002, 10:41 PM
ah! thanks, got it. i wasn't logged in...duh.

Xenon
11-08-2002, 12:03 PM
*gg*

fine now :)