Hi I am new to PHP and have a simple problem but I have not been able to solve it. I have a database on a private server and use the following code for the login:
$conn_string=("host=###### port=###### dbname=test user=###### password=$######")
My problem is that I get an error because my password starts with a $ and it is being regarded as a variable. So I get the following error
Notice: Undefined variable: ######## in C:\wamp\www\test\register.php on line 20
I thought because the the password was within the quotes that it would be exempt from this, so I was wondering if there was a quick fix or if I will have to change the password I use to login to the private server.
Thanks
Two approaches. Put the string in single quotes, which don’t interpret variables:
or escape the
$character: