Re: possible variable declaration error
| From: | matty jones | Date: | Fri, 25 Mar 2011 13:00:21 +0000 |
| Subject: | Re: possible variable declaration error | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-312043@lists.php.net to get a copy of this message | ||
On Fri, Mar 25, 2011 at 8:24 AM, Daniel Brown <danbrown@php.net> wrote:
> On Fri, Mar 25, 2011 at 08:18, matty jones <urlugal@gmail.com> wrote:
> > I get the following error " PHP Notice: Undefined index: publisher in
> > /var/www/testfunctions.php on line 65" and I have narrowed it down to
> what I
> > *think* is a variable not being declared. Here is the code.
>
> This line is the issue:
>
> > if ($d_series_fetch ->execute(array($_GET['publisher']))) {
>
> $_GET is populated, in part, by the query string --- the data
> following the question mark in your browser. For example:
>
> http://example.com/fake.php?publisher=Random%20House
>
> <?php echo $_GET['publisher']; // Output: Random House ?>
>
> So, as you can see, it's complaining because you didn't give it
> that information. If you don't always want to have to do so, surround
> it with an isset() case.
>
> I used the format of your link and that gave me something like what I was
looking for, so I am sure now the error is just in my markup. How would I
get this to work without passing it a value or does the function not work
like that, in which case no biggy I am just trying to figure all this out
the old fashioned way. I read the manual page for the function and I
thought that the type of setup I was using would work.
> --
> </Daniel P. Brown>
> Network Infrastructure Manager
> http://www.php.net/
>