Re: [PHP] mysql_connect noob question

[email protected] (Matijn Woudt)
Newsgroups php.general
Message-ID <CAC_gtuPnRQvBG3xT8zVbkVwSmLKWrsvtpdAi8Md9HmbXds=A8A@mail.gmail.com>
On Fri, Apr 19, 2013 at 10:43 PM, Glob Design Info <[email protected]>wrote:

> I know this has probably been answered already.
>
> When I pass a user name and password from a form to my PHP script and then
> pass those to mysql_connect it doesn't connect. When I paste those exact
> same values into mysql_connect as string literals it works.
>
> Can anyone tell me why this happens?
>
> I know the strings are identical to the literals I try in a test but they
> don't work when submitted via form.
>
> $form_user = $_POST[ 'user' ];
> $form_pass = $_POST[ 'password' ];
>
> # Connect to remote DB
>
> $LINK = mysql_connect( $host, $form_user, $form_pass );
>
> And yes, my $host param is correct.
>
> Thanks,
>
>
Try printing the $form_user and form_pass values, it might be that it's
just an error elsewhere, maybe field name is different in the html?
Otherwise, it might be you have some php init setting, like magic quotes
that does something with the input data.

- Matijn
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.