"Andre" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Inside of one ARRAY can I make one WHILE
>
> function tabelas($tabela_tipo){
> $sql = mysql_query("SELECT * FROM ".$tabela_tipo."_credito ORDER BY
> ".$tabela_tipo."_ordenar");
> $return = "<select name=\"tabelas\" class=\"textblack\">\n";
> $tabela_array = array("".
> while($registo = mysql_fetch_array($sql)){
> array ("".$registo[0]."",
> "".$registo[0]." ".$registo[0]."");
> }.""
> foreach($tabela_array as $subarray)
> list($num, $text) = $subarray;
> $return .= "<option value=\"$num\"
> selected>$text</option>\n";
> }
> $return .= "</select>\n";
> return $return;
> }
>
>
I guess your loop should look like this:
while ($registo = mysql_fetch_array($sql)) {
echo '<option value="' . $registo[0] . '">' . $registo[1] . '</option>';
}
You can use mysql_fetch_assoc() and then access the values by their column
name:
$registo['column1'], $registo['column2'] etc.
Regards, Torsten Roehr
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php