Re: possible variable declaration error
| From: | Daniel Brown | Date: | Fri, 25 Mar 2011 12:24:10 +0000 |
| Subject: | Re: possible variable declaration error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-312040@lists.php.net to get a copy of this message | ||
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.
--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/