Mark F
Mark F

Reputation: 1543

PHP Syntax - Connecting to Database

I created a database through an online site and would like to connect to it from my android Activity. I believe that the core issue is my PHP file. I keep getting a syntax error from this line of code:

$con = mysqli_connect('h31.170.234.43', “markf”, “boston”, “a9208078_mydb”);

The name of my file is Register.php and the error is:

Parse error: syntax error, unexpected T_VARIABLE in /home/a9208078/public_html/Register.php on line 2

First, I'm curious if my parameters are correct, Host Name, the username that I used for that site, my password, and the database name?

Does anyone know why this error is occuring? Thanks so much!

PS: I changed the information around from my actual password and database name for obvious security reasons but the idea is the same

Upvotes: 0

Views: 38

Answers (1)

John Conde
John Conde

Reputation: 219804

You're using funky quotes around three parameter values. That's what happens when you copy and paste your code from a blog post or tutorial.

$con = mysqli_connect('h31.170.234.43', 'markf', 'boston', 'a9208078_mydb');

FYI, your IP address is invalid and probably also a copy and paste error or typo.

Upvotes: 2

Related Questions