Re: [PHP] Function expects string but receiving array Warming??

2002-09-03 Thread Jean-Christian Imbeault

Justin French wrote:
> But the
> really interesting bit is that you appear to be using it NOT for sending
> HTTP headers, but for setting header information on a TABLE

Oops!!

I had defined my own function called header() without even stopping to 
think there was already a PHP header() function.

Silly me ...

Jc


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




Re: [PHP] Function expects string but receiving array Warming??

2002-09-03 Thread Chris Wesley

On Tue, 3 Sep 2002, Jean-Christian Imbeault wrote:

> Warning: header() expects parameter 1 to be string, array given in
> /www/htdocs/jc/administration/edit_products/show_products.php on line 96
>
> How can I fix my code to get rid of this error (while keeping the var as
> an array)?My code looks like this:
>
> header(array("ID","Name","Maker's Code","Maker Name","Label Name","Product Type"));

header() is a PHP function.  You're calling it with an invalid arguement.
(I think you're just calling the function you want by the wrong name, tho.)

> function header_row($aH) {

Try calling header_row(), instead of header(), with your array argument,
since it seems that you already have the proper function defined.

g.luck,
~Chris


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




Re: [PHP] Function expects string but receiving array Warming??

2002-09-03 Thread Justin French

You are trying to set a header() using methods not supported.  But the
really interesting bit is that you appear to be using it NOT for sending
HTTP headers, but for setting header information on a TABLE

read http://php.net/header

...this isn't what it does.

";
foreach($values as $key => $value)
{
$output .= "";
$output .= $value;
$output .= "";
}
$output .= "";
return $output;
}

$myheaders = array("ID","Name","Maker's Code","Maker Name","Label
Name","Product Type");

echo header_row($myheaders);
?>

The above should (untested) echo the following HTML:

IDNameMaker's CodeMaker
NameLabel NameProduct Type

... which is what I think you're after... althoug it seems a little weird :)


Justin







on 03/09/02 6:20 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

> I get the following warning which makes no sense to me.
> 
> Warning: header() expects parameter 1 to be string, array given in
> /www/htdocs/jc/administration/edit_products/show_products.php on line 96
> 
> It's true that I am passing at an array to the function, but what I
> don't understand is why the function expects a string?
> 
> How does any function know the type of an incoming var in PHP anyway?
> 
> How can I fix my code to get rid of this error (while keeping the var as
> an array)?My code looks like this:
> 
> header(array("ID","Name","Maker's Code","Maker Name","Label
> Name","Product Type"));
> 
> function header_row($aH) {
> echo "  ";
> foreach ($aH as $h) {
> ?>
> 
> 
> 
>  }
> echo "  ";
> }
> 


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




[PHP] Function expects string but receiving array Warming??

2002-09-03 Thread Jean-Christian Imbeault

I get the following warning which makes no sense to me.

Warning: header() expects parameter 1 to be string, array given in 
/www/htdocs/jc/administration/edit_products/show_products.php on line 96

It's true that I am passing at an array to the function, but what I 
don't understand is why the function expects a string?

How does any function know the type of an incoming var in PHP anyway?

How can I fix my code to get rid of this error (while keeping the var as 
an array)?My code looks like this:

header(array("ID","Name","Maker's Code","Maker Name","Label 
Name","Product Type"));

function header_row($aH) {
   echo "  ";
   foreach ($aH as $h) {
?>
 
   
 
";
}


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