Re: [PHP-DB] [ Re: [PHP-DB] Filling Drop-Down Box.]

2004-12-28 Thread Nayyar Ahmed
Hello Alex:

It is really helpfull, :)

thanks for your detailed reply

regards,

On Sat, 25 Dec 2004 23:57:51 +0200, Alexandru Mihai [EMAIL PROTECTED] wrote:
 SELECT name=student title=Student list
 
OPTION value=---/OPTION
 ?PHP
while ($row = mysql_fetch_array($result)) {
 ?
OPTION value=?php echo $row[3]? title=Select student ?php
 echo $row[1], , $row[2]? ?php echo $row[3]?/OPTION
 ?php
 }
 ?
/SELECT
 In this case I've assumed that you'll have in mysql the following table:
 row0: id (autoincrement)
 row1: Nick name
 row2: First name
 row3: Last name
 
 You can modify the code as you wish to get what you need.
 
 Alexandru Mihai
 
 
 Bastien Koert wrote:
 
  i suggest you google for this...there are a million examples of this
  kind of code
 
  bastien
 
  From: Nayyar Ahmed [EMAIL PROTECTED]
  Reply-To: Nayyar Ahmed [EMAIL PROTECTED]
  To: php-db@lists.php.net
  Subject: [PHP-DB] Filling Drop-Down Box.
  Date: Sat, 25 Dec 2004 20:18:05 +0500
 
  Hello All,
 
  I want to fill drop-down box from mysql table, if any body
  be kind to tell me a sample code :)
  e.g:
  In my application i want to gather subject list from current
  semester-subject table of a student.
 
  TIA
  --
  Nayyar Ahmad
 
  Lecturer
  Faculty Of Computer Science,
  Institute Of Management Sciences,
  Hayat Abad Peshawar , Pakistan.
  Office : 92-091-9217404 , 9217452
  Cell :  92-0333-9139461
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Nayyar Ahmad

Lecturer
Faculty Of Computer Science,
Institute Of Management Sciences,
Hayat Abad Peshawar , Pakistan.
Office : 92-091-9217404 , 9217452
Cell :  92-0333-9139461

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Filling Drop-Down Box.

2004-12-25 Thread Nayyar Ahmed
Hello All,

I want to fill drop-down box from mysql table, if any body
be kind to tell me a sample code :)
e.g:
In my application i want to gather subject list from current 
semester-subject table of a student. 

TIA
-- 
Nayyar Ahmad

Lecturer
Faculty Of Computer Science,
Institute Of Management Sciences,
Hayat Abad Peshawar , Pakistan.
Office : 92-091-9217404 , 9217452
Cell :  92-0333-9139461

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Filling Drop-Down Box.

2004-12-25 Thread Bastien Koert
i suggest you google for this...there are a million examples of this kind of 
code

bastien
From: Nayyar Ahmed [EMAIL PROTECTED]
Reply-To: Nayyar Ahmed [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Filling Drop-Down Box.
Date: Sat, 25 Dec 2004 20:18:05 +0500
Hello All,
I want to fill drop-down box from mysql table, if any body
be kind to tell me a sample code :)
e.g:
In my application i want to gather subject list from current
semester-subject table of a student.
TIA
--
Nayyar Ahmad
Lecturer
Faculty Of Computer Science,
Institute Of Management Sciences,
Hayat Abad Peshawar , Pakistan.
Office : 92-091-9217404 , 9217452
Cell :  92-0333-9139461
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Filling Drop-Down Box.

2004-12-25 Thread Mike S.
 Hello All,

 I want to fill drop-down box from mysql table, if any body
 be kind to tell me a sample code :)
 e.g:
 In my application i want to gather subject list from current
 semester-subject table of a student.

 TIA
 --
 Nayyar Ahmad

You know that the HTML code for the drop-down is:
SELECT NAME=SAMPLE
OPTION VALUE=1Whatever 1/OPTION
OPTION VALUE=2Whatever 2/OPTION
/SELECT

Here's some pseudo-code remarks that should help you with your coding:

- whatever.html -
Drop-down: SELECT NAME=sample
?php
   //  connect to your database - if you haven't already
   //  construct a query to pull the records you want, and
   //  in the order you want to display them
   //  execute the query
   //  loop through the results, building an OPTIONwhatever/OPTION
   //  for each element in the drop-down.  You can get creative
   //  here if you need to.  Like:
   //  OPTION VALUE=##whatever/OPTION
   //  where ## is the key field, and whatever is another
   //(descriptive) field in your query
   //  close your database connection (or later, if needed)
?/SELECT

Try to fill in the actual code yourself.
If you get stuck, you can look at:
http://www.netmask.com/php-db/sample-dropdown.html

Good luck!

:Mike S.
:Austin TX USA

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] [ Re: [PHP-DB] Filling Drop-Down Box.]

2004-12-25 Thread Alexandru Mihai
SELECT name=student title=Student list
  OPTION value=---/OPTION
?PHP
  while ($row = mysql_fetch_array($result)) {
?
  OPTION value=?php echo $row[3]? title=Select student ?php 
echo $row[1], , $row[2]? ?php echo $row[3]?/OPTION
?php
}
?
  /SELECT
In this case I've assumed that you'll have in mysql the following table:
row0: id (autoincrement)
row1: Nick name
row2: First name
row3: Last name

You can modify the code as you wish to get what you need.
Alexandru Mihai
Bastien Koert wrote:
i suggest you google for this...there are a million examples of this 
kind of code

bastien
From: Nayyar Ahmed [EMAIL PROTECTED]
Reply-To: Nayyar Ahmed [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Filling Drop-Down Box.
Date: Sat, 25 Dec 2004 20:18:05 +0500
Hello All,
I want to fill drop-down box from mysql table, if any body
be kind to tell me a sample code :)
e.g:
In my application i want to gather subject list from current
semester-subject table of a student.
TIA
--
Nayyar Ahmad
Lecturer
Faculty Of Computer Science,
Institute Of Management Sciences,
Hayat Abad Peshawar , Pakistan.
Office : 92-091-9217404 , 9217452
Cell :  92-0333-9139461
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php