Re: PHP and MYSQL Security`
| From: | Brian Clark | Date: | Mon, 28 Jan 2002 01:25:17 +0000 |
| Subject: | Re: PHP and MYSQL Security` | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82345@lists.php.net to get a copy of this message | ||
* Miles Thompson (milesthompson@ns.sympatico.ca) [Jan 27. 2002 19:55]:
Hi Miles,
[...]
> $hostname = "12.34.56.78";
> $user = "username";
> $password = "password";
> $dbname = "database";
> and change your connection string as follows:
> include 'params.inc';
> //maybe some other stuff her
> $conn = mysql_connect( '$hostname', '$user', '$password');
> mysql_select_db('$dbname',$conn) or die( mysql_errno()." :
> ".mysql_error());
Careful there.
'$hostname', '$user', '$password', and '$dbname' aren't
interpolated.
They're literally taken as the string $hostname, etc.
Leave off the 's or surround the variables in double quotes. But you
know that. ;-D
--
Brian Clark | Avoiding the general public since 1805!
Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8
Always proofread carefully to see if you