Re: Still trying to figure this out...
| From: | Jochem Maas | Date: | Mon, 19 Jun 2006 23:40:28 +0000 |
| Subject: | Re: Still trying to figure this out... | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238346@lists.php.net to get a copy of this message | ||
Rob W. wrote:
> Nope, I still dont get anything back from that.
it will AT THE VERY LEAST return the string:
'<select name="port"></select>'
do you have any idea what you have in your database???
and have you ever heard of print_r() or var_dump()? you can use them
to *investigate* your problem.
...
>> $sqlRange = array();
>> if ($res = mysql_query('SELECT switchport FROM network')) {
>> while ($row = mysql_fetch_array($res)) $sqlRange[] = $row['switchport'];
>> }
var_dump($sqlRange, array_diff(range(1,24), $sqlRange));
>>
>> echo '<select name="port">';
>> foreach (array_diff(range(1,24), $sqlRange) as $port) {
>> echo '<option
>> value="',$port,'">',$port,'</option>';
>> }
>> echo '</select>';
>>
>> /*
>>
>> NOTE:
>>
>> 1. you have to loop your mysql result to get each port that is already
>> used in the DB into you array
>> 2. try to output something that resembles proper HTML (an <option>
>> without a closing tag sucks)
>>
>> */
>>
>>
>