PDA

View Full Version : selecting random entry from db


mr e
12-30-2002, 02:10 AM
ok i have this code

$battlescene=$DB_site->query("SELECT name FROM rpg_battlescenes ORDER BY rand() LIMIT 1");

to select a random "name" entry from the db and i want to be able to use $battlescene in a template, i THOUGHT you would do this

eval("\$battlescene = \"".gettemplate("battle_arena")."\";");

but for some reason it's not doing what i want it too, is the code right so far?

also right under all that code is

eval("dooutput(\"".gettemplate('battle_arena')."\");");

does that have anything to do with how i would go about this?

Xenon
12-30-2002, 10:18 AM
you have to use $battlescene[name] within your template

mr e
12-30-2002, 05:21 PM
im gonna kick myself now

lol thanks xenon