Re: Not a Valid MySQL-Link Resource
| From: | Sascha Cunz | Date: | Sat, 19 Oct 2002 20:56:08 +0000 |
| Subject: | Re: Not a Valid MySQL-Link Resource | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120631@lists.php.net to get a copy of this message | ||
Does print_r($main); show anything directly after your mysql_connect?
$main must get lost somewhere on the way, i think - but this seems strange.
Sascha
Am Samstag, 19. Oktober 2002 22:44 schrieb Stephen:
> I'm not in a function though I tried the global anyway, same error.
>
> Nothing is overwriting $main and when I put print_r($main), nothing showed.
>
>
> ----- Original Message -----
> From: "Sascha Cunz" <Sascha@GaNoAn.org>
> To: "Stephen" <webmaster@melchior.us>; "PHP List"
> <php-general@lists.php.net>
> Sent: Saturday, October 19, 2002 3:45 PM
> Subject: Re: [PHP] Not a Valid MySQL-Link Resource
>
>
> Well, there are a 10000 conditions where this could happen.
>
> Are you in a function and have to do: global $main; ?
> Is some other part overwriting $main?
>
> What says print_r($main); directly before calling that
> mysql_query-statement?
>
> Sascha
>
> Am Samstag, 19. Oktober 2002 22:37 schrieb Stephen:
> > I'm using $main to get other database information, though, and that it's
> > getting that just fine...
> >
> >
> > ----- Original Message -----
> > From: "Sascha Cunz" <Sascha@GaNoAn.org>
> > To: "Stephen" <webmaster@melchior.us>; "PHP List"
> > <php-general@lists.php.net>
> > Sent: Saturday, October 19, 2002 3:41 PM
> > Subject: Re: [PHP] Not a Valid MySQL-Link Resource
> >
> >
> > At the point, where you get the obvious error, $main might not be set
> > correctly; this is just, what PHP complains about.
> >
> > Sascha
> >
> > Am Samstag, 19. Oktober 2002 22:33 schrieb Stephen:
> > > Here's $main:
> > >
> > > $main = mysql_pconnect($hostname_main, $username_main, $password_main)
>
> or
>
> > > die(mysql_error());
> > >
> > > I won't give the user, host, pass, etc for obvious reasons. I'm
> > > connecting to the database jsut fine though.
> > >
> > > ----- Original Message -----
> > > From: "John Nichel" <jnichel@by-tor.com>
> > > To: "Stephen" <webmaster@melchior.us>
> > > Cc: "PHP List" <php-general@lists.php.net>
> > > Sent: Saturday, October 19, 2002 3:33 PM
> > > Subject: Re: [PHP] Not a Valid MySQL-Link Resource
> > >
> > > > What's $main? What does you connection string look like?
> > > >
> > > > Stephen wrote:
> > > > > Hello,
> > > > >
> > > > > I'm having some trouble understanding this error I'm getting.
> > > > > Here's the
> > >
> > > error:
> > > > > Warning: mysql_query(): supplied resource is not a valid MySQL-Link
> > >
> > > resource in c:\phpdev5\www\newsletter\index.php on line 38
> > >
> > > > > Now here's the block of code that goes into the query:
> > > > >
> > > > > $key = $HTTP_GET_VARS['key'];
> > > > > $email = $HTTP_GET_VARS['email'];
> > > > > $sql = "SELECT * FROM users WHERE key='$key' AND
>
> email='$email'";
>
> > > > > $query = mysql_query($sql, $main);
> > > > >
> > > > > Please help!
> > > > >
> > > > >
> > > > > Thanks,
> > > > > Stephen Craton
> > > > > http://www.melchior.us
> > > > > http://php.melchior.us
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit:
> > > > http://www.php.net/unsub.php