RE: [PHP-DB] Select statement only returns 1 record

2002-01-30 Thread Rick Emery

It's worked for me.  

You'll note that I added a new column "id".  Did you put that in your
table??
What error did you get

-Original Message-
From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 2:18 PM
To: 'Rick Emery'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Select statement only returns 1 record


Nope, that doesn't work

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 30, 2002 1:01 PM
To: 'Todd Williamsen'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Select statement only returns 1 record


";
while( $row = mysql_fetch_array($result) )
{
$FirstName = $row['FirstName'];
$LastName = $row['LastName'];
$id=$row['id'];
print "$LastName, $FirstName";
}
?>
print "";

-Original Message-
From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 12:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select statement only returns 1 record


I am trying to get data from two columns, FirstName and Last name and
displaying all the records LastName, FirstName in a drop down menu.

The weird thing is that it only displays one record.  I thought the
table
was hosed, but its not.  I tried it through another database and still
doesn't work.

Here is the code:




  
  
  

I would list the whole page but its long!  There is another SQL
statement at
the top of the page:





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Select statement only returns 1 record

2002-01-30 Thread Todd Williamsen

Nope, that doesn't work

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 30, 2002 1:01 PM
To: 'Todd Williamsen'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Select statement only returns 1 record


";
while( $row = mysql_fetch_array($result) )
{
$FirstName = $row['FirstName'];
$LastName = $row['LastName'];
$id=$row['id'];
print "$LastName, $FirstName";
}
?>
print "";

-Original Message-
From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 12:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select statement only returns 1 record


I am trying to get data from two columns, FirstName and Last name and
displaying all the records LastName, FirstName in a drop down menu.

The weird thing is that it only displays one record.  I thought the
table
was hosed, but its not.  I tried it through another database and still
doesn't work.

Here is the code:




  
  
  

I would list the whole page but its long!  There is another SQL
statement at
the top of the page:





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Select statement only returns 1 record

2002-01-30 Thread biorn

You will need to put the option tag in a loop to get all of the records in 
the table.

 (this can go anywhere but in while loop)

";
$i++;
}
?>

Also, without the value in the option tag, you will not be passing anything 
to the form.

HTH

Maureen Biorn


Todd Williamsen <[EMAIL PROTECTED]> said:

> I am trying to get data from two columns, FirstName and Last name and
> displaying all the records LastName, FirstName in a drop down menu.
> 
> The weird thing is that it only displays one record.  I thought the table
> was hosed, but its not.  I tried it through another database and still
> doesn't work.
> 
> Here is the code:
> 
>  $db = mysql_connect($dbserver, $dbuser, $dbpass);
> mysql_select_db($dbname,$db);
> $sortby = "name ASC";
> $sql="SELECT * FROM webl_players ORDER BY $sortby";
> $result=mysql_query($sql,$db);
> $row = mysql_fetch_array($result);
> $FirstName = $row["FirstName"];
> $LastName = $row["LastName"];
> ?>
> 
> 
>   
>   
>   
> 
> I would list the whole page but its long!  There is another SQL statement at
> the top of the page:
> 
>  
> $db = mysql_connect($dbserver, $dbuser, $$dbpass);
> mysql_select_db($dbname, $db);
> $sql = "SELECT * FROM Canidate SORT BY 'LastName'";
> $result = mysql_query($sql);
> ?>
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 



-- 




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Select statement only returns 1 record

2002-01-30 Thread Rick Emery

";
while( $row = mysql_fetch_array($result) )
{
$FirstName = $row['FirstName'];
$LastName = $row['LastName'];
$id=$row['id'];
print "$LastName, $FirstName";
}
?>
print "";

-Original Message-
From: Todd Williamsen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 12:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Select statement only returns 1 record


I am trying to get data from two columns, FirstName and Last name and
displaying all the records LastName, FirstName in a drop down menu.

The weird thing is that it only displays one record.  I thought the table
was hosed, but its not.  I tried it through another database and still
doesn't work.

Here is the code:




  
  
  

I would list the whole page but its long!  There is another SQL statement at
the top of the page:





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Select statement only returns 1 record

2002-01-30 Thread Miles Thompson

Check the manual for the mysql_fetch_array() function, it shows you how to 
extract data from $result. You will use the while loop (as shown in the 
manual's example) to fill your combo box / selct list /drop down menu, 
whatever we're calling that creature today.

Miles

At 12:45 PM 1/30/2002 -0600, Todd Williamsen wrote:
>I am trying to get data from two columns, FirstName and Last name and
>displaying all the records LastName, FirstName in a drop down menu.
>
>The weird thing is that it only displays one record.  I thought the table
>was hosed, but its not.  I tried it through another database and still
>doesn't work.
>
>Here is the code:
>
>$db = mysql_connect($dbserver, $dbuser, $dbpass);
>mysql_select_db($dbname,$db);
>$sortby = "name ASC";
>$sql="SELECT * FROM webl_players ORDER BY $sortby";
>$result=mysql_query($sql,$db);
>$row = mysql_fetch_array($result);
>$FirstName = $row["FirstName"];
>$LastName = $row["LastName"];
>?>
>
>
>   
>   
>   
>
>I would list the whole page but its long!  There is another SQL statement at
>the top of the page:
>
>
>$db = mysql_connect($dbserver, $dbuser, $$dbpass);
>mysql_select_db($dbname, $db);
>$sql = "SELECT * FROM Canidate SORT BY 'LastName'";
>$result = mysql_query($sql);
>?>
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Select statement only returns 1 record

2002-01-30 Thread Todd Williamsen

I am trying to get data from two columns, FirstName and Last name and
displaying all the records LastName, FirstName in a drop down menu.

The weird thing is that it only displays one record.  I thought the table
was hosed, but its not.  I tried it through another database and still
doesn't work.

Here is the code:




  
  
  

I would list the whole page but its long!  There is another SQL statement at
the top of the page:





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]