NYCPHP Meetup

NYPHP.org

[nycphp-talk] next hurdle...

soazine@pop.erols.com soazine at pop.mail.rcn.net
Wed May 21 16:54:43 EDT 2003


Without knowing too much about your table structure and schema I can only
guess that the data in your table is configured in such a way as:

id  name
1   NULL
2   Eumen..
3   Masar..

etc.

Check your data and retry the query parsing, else, try another looping
method

Phil

Original Message:
-----------------
From: Joshua S. Freeman jfreeman at amnh.org
Date: Wed, 21 May 2003 16:47:15 -0400
To: talk at nyphp.org
Subject: [nycphp-talk] next hurdle...


Here's some code:

 <?php       
        $query= mysql_query("select * FROM subfamily");

echo "<select name=\\"subfamily\\"><option value=\\"\\">--select
subfamily--</option>\
";
while ($row = mysql_fetch_row($query)) {
print "<option value=\\"$row[0]\\">$row[1]</option>\
";
}
print ("</select>");



?>   

Here's the result:

<select name="subfamily">
    <option value="">--select subfamily--</option>
    <option value="1"></option>
    <option value="2">Eumeninae</option>
    <option value="3">Masarinae</option>
    <option value="4">Polistinae</option>
    <option value="5">Stenogastrinae</option>
    <option value="6">Vespinae</option>
    <option value="7">Undetermined</option>
</select> 

which is *almost* what I want.

What I *want* is this:


<select name="subfamily">
    <option value="">--select subfamily--</option>
    <option value="1">Eumeninae</option>
    <option value="2">Masarinae</option>
    <option value="3">Polistinae</option>
    <option value="4">Stenogastrinae</option>
    <option value="5">Vespinae</option>
    <option value="6">Undetermined</option>
</select> 

Is there something I can change in my PHP code which will change the results
I have into the results I want?

J.



--- Unsubscribe at http://nyphp.org/list/ ---



--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .






More information about the talk mailing list