I am trying to populate an array with vlaues from a mysql database with the code:
<?php
include_once("config.php");
$query = "SELECT * FROM guestbook ";
$r = mysql_query($query)) or die(mysql_error());
$x=0;
while($row = mysql_fetch_array($r))
{
$e=( $row['email'].": "."<br>");
$c=( $row['comments']);
$both[$x]= $e.$c;
$r++;
$x++;
}
mysql_close();
?>
and my code works and populates my array and I can output the values, but I get an error:
mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)...
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in...
which I dont understand, because the data is being taken from the database and being displayed.
In a nutshell, everything works, but Im getting an error...
I connect with my config.php
<?php
include_once("config.php");
$query = "SELECT * FROM guestbook ";
$r = mysql_query($query)) or die(mysql_error());
$x=0;
while($row = mysql_fetch_array($r))
{
$e=( $row['email'].": "."<br>");
$c=( $row['comments']);
$both[$x]= $e.$c;
$r++;
$x++;
}
mysql_close();
?>
and my code works and populates my array and I can output the values, but I get an error:
mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)...
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in...
which I dont understand, because the data is being taken from the database and being displayed.
In a nutshell, everything works, but Im getting an error...
I connect with my config.php