3

Im using XAMPP, and what i've done is tryng to connect to the database on phpmyadmin, however an error is prompt saying syntax error, the code is right however.

Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\csgopit\connect.php on line 10

The code itself is really simple and i dont understand why it's not working.

<?php
//connect.php
$server = 'localhost';
$username   = 'zimmer';
$password   = 'vegas2';
$database   = 'csgopit';


if(!mysql_connect($server, $username,  $password)){    exit('Error: could not establish database connection');}
if(!mysql_select_db($database){    exit('Error: could not select the database');}
?>

The database on PHPMYADMIN has that user and password in it.

I've started learning MYSQL a while ago, and i'm interested in php aswell, so starting with it right now actually, pardon if the question is dumb.

0

1 Answer 1

7
if(!mysql_select_db($database){    exit('Error: could not select the database');}
                             ^ missing closing if ) parenthesis here
1
  • Thank you, rookie mistake! Good clear explanation, thank you. Commented Aug 13, 2015 at 0:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.