I'm getting this after a fresh install from XAMPP. Starting SQL and Apache and running a simpel PHP script which connects to the database and just lists the contents (database and tabels are created, just in case anyone asks ).
Could not connect: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock'.
This is the PHP script ...
- Code: Select all
<?PHP
$link = mysql_connect("localhost","root","");
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("barts_store");
$query = 'SELECT * FROM producten';
$results = mysql_query($query);
echo "<?xml version=\"1.0\"?>\n";
echo "<producten>\n";
while($line = mysql_fetch_assoc($results)) {
echo "<item>" . $line["product"] . "</item>\n";
}
echo "</products>\n";
mysql_close($link);
?>