Re: Function questions...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



$sys is an array, so echoing $sys will cause problems.

Are you trying to get a 4xN table of values and checkboxes? There's
got to be an easier way...

--- "NIPP, SCOTT V (SBCSI)" <sn4265@sbc.com> wrote:
> 	I am trying to convert something that I have working in a PHP
> script
> to be a function in a library type of file.  The code contained in
> the
> function works fine in another script, but I am currently getting
> no output
> from the function.  I have a question about the nature of functions
> that may
> help clear up my problems.
> 
> 	Do 'echo' commands within functions actually work to directly
> display information?  I have only used functions up to this point
> that use
> the 'return' command to pass a variable back to the script that
> called the
> function.  I am pretty confused on how to actually use a function
> that
> formats data to be displayed.  This is my primary source of
> confusion.
> 
> 	Below is the function that is giving me trouble:
> 
> function CheckboxList($query) {
>   $result1 = mysql_query($query);
>   do {
>     $sys = split('-', $list['id-sys']);
>     if ($cnt == 1) { 
>       $cnt = 2; 
>       echo "<tr><td width=\"161\"><input name=\"system[]\"
> type=\"checkbox\"
> value=\"$sys\">";
>       echo $sys."</td>";
>     } elseif ($cnt == 2) { 
> 	  $cnt = 3;
>       echo "<tr><td width=\"161\"><input name=\"system[]\"
> type=\"checkbox\"
> value=\"$sys\">";
>       echo $sys."</td>";
>     } elseif ($cnt == 3) { 
> 	  $cnt = 4;
>       echo "<tr><td width=\"161\"><input name=\"system[]\"
> type=\"checkbox\"
> value=\"$sys\">";
>       echo $sys."</td>";
> 	} elseif ($cnt == 4) { 
> 	  $cnt = 1;
>       echo "<tr><td width=\"161\"><input name=\"system[]\"
> type=\"checkbox\"
> value=\"$sys\">";
>       echo $sys."</td></tr>";
> 	}
>   } while ($list = mysql_fetch_assoc($result1));
> }
> 
> 	Here is also the way I am calling this function:
> <snip...>
> $query = "SELECT * FROM accounts WHERE
> verifyurl='$safe_verify_string'";
> <snip...>
> CheckboxList($query);
> <snip...>
> 
> 	Is there something wrong with the way in which I am calling this
> function?  Thanks in advance for all the help.
> 
> 
> Scott Nipp
> Phone:  (214) 858-1289
> E-mail:  sn4265@sbc.com
> Web:  http:\\ldsa.sbcld.sbc.com
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=====
Mark Weinstock
mark_weinstock@yahoo.com
***************************************
You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing.
-Stolen from the now-defunct Randy's Random mailing list.
***************************************

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux