DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • June 18, 2013, 12:24:34 AM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: [1]   Go Down
  Print  
Author Topic: Drop down bar  (Read 337 times)
0 Members and 1 Guest are viewing this topic.
The Doctor
Mod God
*****
Offline Offline

Posts: 1100


Doctor.. Who?


View Profile WWW
« on: July 19, 2012, 08:36:37 AM »

If I have a database row called rpalignment, and that database row contains two sections, name and id, how do I extract those so that the names appear in a drop-down bar?

I've tried:
Code:
<?php

$sql 
"SELECT name,id FROM `".db_prefix("rpalignment");
$res db_query($sql);

while (
$row db_fetch_assoc($res)){
rawoutput("<option value={$row['id']}>{$row['name']}</option>");
}
rawoutput("</select>");
?>

but that doesn't seem to work.
« Last Edit: July 19, 2012, 08:38:40 AM by Aeolus » Logged


Time Lords Online - A Doctor Who RPG! Open Now!

~ My Modules: PM me if you would like me to code something! ~
Brendan
I am Brendan.
Mod God
*****
Offline Offline

Posts: 823


View Profile
« Reply #1 on: July 19, 2012, 08:56:55 AM »

Code:
<?php

$sql 
"SELECT name,id FROM " db_prefix("rpalignment") . "";
$res db_query($sql);

rawoutput("<select name='select'>");
while ($row db_fetch_assoc($res)){
rawoutput("<option value={$row['id']}>{$row['name']}</option>");
}
rawoutput("</select>");
?>

Logged
The Doctor
Mod God
*****
Offline Offline

Posts: 1100


Doctor.. Who?


View Profile WWW
« Reply #2 on: July 19, 2012, 06:20:55 PM »

Thanks, Brendan. xD It doesn't seem to work with the SQL query inside the select tags.. xD
Logged


Time Lords Online - A Doctor Who RPG! Open Now!

~ My Modules: PM me if you would like me to code something! ~
Brendan
I am Brendan.
Mod God
*****
Offline Offline

Posts: 823


View Profile
« Reply #3 on: July 19, 2012, 07:18:50 PM »

The query isn't in the select tags. I tested it before hand and it was working.
Logged
The Doctor
Mod God
*****
Offline Offline

Posts: 1100


Doctor.. Who?


View Profile WWW
« Reply #4 on: July 19, 2012, 08:07:29 PM »

The query isn't in the select tags. I tested it before hand and it was working.

Curious and curiouser.. o.o Everything with computers hates me. xD
Logged


Time Lords Online - A Doctor Who RPG! Open Now!

~ My Modules: PM me if you would like me to code something! ~
Nightborn
Captain of the Guard
***
Offline Offline

Posts: 157


View Profile
« Reply #5 on: July 20, 2012, 11:04:42 AM »

I believe ... Logic is not something made for your  Cry
Logged
The Doctor
Mod God
*****
Offline Offline

Posts: 1100


Doctor.. Who?


View Profile WWW
« Reply #6 on: July 20, 2012, 11:06:36 AM »

I believe ... Logic is not something made for your  Cry

Logic..? What is this logic you speak of? Huh
Logged


Time Lords Online - A Doctor Who RPG! Open Now!

~ My Modules: PM me if you would like me to code something! ~
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

Support Us
$100 raised this year
Your help is greatly appreciated!
Who's Online
26 Guests, 0 Users
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search