Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP parse error [duplicate]

Tags:

php

mysql

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.

like image 523
LesterNotTheMolestor Avatar asked Jun 09 '26 07:06

LesterNotTheMolestor


1 Answers

if(!mysql_select_db($database){    exit('Error: could not select the database');}
                             ^ missing closing if ) parenthesis here
like image 152
FuzzyTree Avatar answered Jun 10 '26 22:06

FuzzyTree



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!