On Fri, 20 Aug 2004 19:34:51 +0100, Andre <[EMAIL PROTECTED]> wrote:
> 
> 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("".

No, you can't do such a thing. First of all, array() is a language
construct and creates an array from values passed into it. Second,
you're using period (.) here...what exactly are you trying to do?
Perhaps you should try:

$tablea_array = array();

>            while($registo = mysql_fetch_array($sql)){
>            array ("".$registo[0]."",

*WHY* are you concatenating a value to two empty strings? This
effectively changes the type of the variable to a string, but since
it's coming from the DB it's already a string. And besides which, it
very rarely matters to PHP whether something is a string or a number,
it will convert between them automatically.

> "".$registo[0]."&nbsp;".$registo[0]."");

Maybe you mean to do:

$tablea_array[] = array ($registo[0], $registo[0].'&nbsp;'.$registo[0]);

>           }.""

And remove the ."" here.

>        foreach($tabela_array as $subarray) {
>            list($num, $text) = $subarray;
>                $return .= "<option value=\"$num\"
> selected>$text</option>\n";
>        }
>        $return .= "</select>\n";
>        return $return;
>     }
> 

You really need to go back and run through some PHP tutorials, it
seems you don't really understand the language.

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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

Reply via email to