I try to connect my php website with a XAMPP Server so I can access my MySQL database. Any Ideas how the config has to look like, because I’m rather stuck with this one.
I tried to make a config but it didnt really work. I’ll post my current config below:
<?php
try
{
global $con;
$server = 'localhost:3307';
$user = 'root';
$schema = '';
$con = new PDO('mysql:host='.$server.';schema = '.$schema.';charset=utf8', $user);
$con->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
}
catch(Exception $e)
{
echo $e->getCode().': '.$e->getMessage();
}
New contributor
Mrco is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.