So I'm getting this error,
Parse error: syntax error, unexpected '$conn' (T_VARIABLE) in C:\MAMP\htdocs\Blog\verwerk.php on line 14.
This is my script
<?php
/**
* Created by PhpStorm.
* User: Desir
* Date: 10-5-2017
* Time: 11:55
*/
$servername = "localhost";
$username = "root";
$password = "-";
try {
$conn = new PDO("mysql:host=$servername;dbname=blog", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
}
catch(PDOException $e)
{
echo "Connection failed: " . $e->getMessage();
}
?>
I can't figure out a way to get it working been trying loads of stuff. Would be nice if someone could actually help me figure this out.
Thanks.