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.

1 Answers1

7
if(!mysql_select_db($database){    exit('Error: could not select the database');}
                             ^ missing closing if ) parenthesis here
FuzzyTree
  • 32,014
  • 3
  • 54
  • 85