[PHP] Re: Forms Question: Options

2004-12-11 Thread Matthew Weier O'Phinney
* Steve Marquez [EMAIL PROTECTED]:
 I created a photo upload utility with individual galleries that images can
 be uploaded into. In the MySQL database, there are multiple names of
 galleries, some are the same. I want to have a select menu to show just the
 unique names of the galleries.

 I have used:

 Select DISTINCT gallery_names from images_upload;

 I have about 15 records, ten are GALLERY1 and 5 are GALLERY2. When I use
 the DISTINCT, two are output. It works perfectly in the MySQL terminal.

 However, when I use the same in PHP as a web page, it only outputs one, the
 one with only 5 records.

 Here is the code:

 ?php 

 // log into our local server using the MySQL root user.
$dbh = mysql_connect( hostname, username, password );

// select the database.
mysql_select_db( db ) or die ( mysql_error() . \n );
 
//and read it back for printing purposes.
$get_table_data = SELECT DISTINCT gallery_name FROM images_upload ORDER
 BY gallery_name DESC;

$response = mysql_query( $get_table_data, $dbh );

//now print it out for the user.
if ( $one_line_of_data = mysql_fetch_array( $response ) ) {

It's only printing out one record because you're only fetching from the
results set once. Change that to :

while ($one_line_of_data = mysql_fetch_array($response)) {

and you should be set.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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


[PHP] Re: Forms Question

2003-02-15 Thread rush
Beauford.2002 [EMAIL PROTECTED] wrote in message
000701c2d51c$616206d0$6401a8c0@p1">news:000701c2d51c$616206d0$6401a8c0@p1...
 Im trying to figure out the best way to do the following.  I need to have
a
 series of forms that when the user finishes the first part of the form he
is
 sent to another page where a second form is filled out, and then a third.
 Making the forms etc. is no problem, what I'm not sure of is how to keep
the
 data from all forms so it can be displayed at the end. I don't want to
have
 anything written to the users drive, or to the server - so this
information
 would have to be kept in memory. Would an array work in this situation?

how about using layers and javascript to switch between the parts of the
form. User will have wizard like behaviout (form with next and prev
buttons), and to the php, everything will be submitted as one large form.

rush
--
http://www.templatetamer.com/




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