Re: mysql_connect noob question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



One other thing I noted in the FAQ was this:

"Dots in incoming variable names
Typically, PHP does not alter the names of variables when they are passed into a script. However, it should be noted that the dot (period, full stop) is not a valid character in a PHP variable name. For the reason, look at it:

<?php$varname.ext;  /* invalid variable name */
?>
Now, what the parser sees is a variable named $varname, followed by the string concatenation operator, followed by the barestring (i.e. unquoted string which doesn't match any known key or reserved words) 'ext'. Obviously, this doesn't have the intended result.
For this reason, it is important to note that PHP will automatically replace any dots in incoming variable names with underscores."

I should note my user name in this case *is* an email address, however the dots in that address are *not* being converted to underscores as mentioned (at least not visibly).


On Apr 21, 2013, at 8:39 AM, tamouse mailing lists <tamouse.lists@xxxxxxxxx> wrote:

> On Fri, Apr 19, 2013 at 3:43 PM, Glob Design Info <info@xxxxxxxxxxxxxx> 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,
> 
> So, um, look at this gist: https://gist.github.com/tamouse/5430012
> 
> I know this never helps, but 'Works for me!'

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux