Bastien Koert wrote:
> On Fri, Apr 17, 2009 at 11:41 AM, Adam Williams
> <[email protected]>wrote:
>
>> I have the code:
>>
>> $mysqli_get_support_types = "Select types from support_types order by
>> types";
>> $mysqli_get_support_types_result =
>> mysqli_query($mysqli,$mysqli_get_support_types) or
>> die(mysqli_error($mysqli));
>>
>> while (mysqli_fetch_array($mysqli_get_support_types_result))
>> {
>> echo "<option>".$mysqli_get_support_types[types];
>> }
>> echo "</select>
>>
>> but when I go to the web page source it displays:
>>
>>
>> <select><option>S<option>S<option>S<option>S<option>S<option>S<option>S<option>S<option>S<option>S</select>
>>
>> but the query runs correctly in MySQL. So why is php just printing S's?
>>
>> mysql> Select types from support_types order by types;
>> +---------------------+
>> | types |
>> +---------------------+
>> | Change User |
>> | Computer Hardware |
>> | Computer Peripheral |
>> | Computer Software |
>> | Delete User |
>> | Networking |
>> | New Project |
>> | New User |
>> | Server |
>> | Telephone |
>> +---------------------+
>> 10 rows in set (0.00 sec)
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> shoulnd't this
> echo "<option>".$mysqli_get_support_types[types];
>
> be
>
> echo "<option>".$mysqli_get_support_types_result[types];
>
No. How about:
while ($row = mysqli_fetch_array($mysqli_get_support_types_result))
{
echo "<option>".$row['types'];
}
--
Thanks!
-Shawn
http://www.spidean.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php