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
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, rookie mistake! Good clear explanation, thank you.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.