Hej .
Har i længere tid døjet med et problem med en gæstebog jeg prøver at sætte ind på min hjemmeside.
Når man tilføjer en besked kommer den fint ind i databasen, men den vil ikke hente den ud igen, og kommer i stedet med disse fejlmeddelelser;
Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /usr/home/web/web137144/tagwall_load.php on line 15
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /usr/home/web/web137144/tagwall_load.php on line 15
Error:Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Håber nogen kan hjælpe !
Her er koden (tagewall_load.php) den referer til:
<?
$rowsPerPage = "10";
// by edfault how first page
$pageNum = 1;
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
// counting where to start fetching the entries
$offset = ($pageNum -1) * $rowsPerPage;
$query = "SELECT * FROM tagwall ORDER BY id DESC LIMIT $offset, $rowsPerPage";
$result = mysql_query($query) or die('Error:'.mysql_error());
$num_rows = mysql_num_rows($result);
while($row = mysql_fetch_array($result))
{
echo "<center><table width=\\"75%\\" border=\\"0\\" cellpadding=\\"0\\" cellspacing=\\"0\\">
<tr align=\\"left\\">
<td width=\\"25%\\">Besked fra:<p></td>
<td width=\\"75%\\"><a href=\\"mailto:" . $row['email'] . "\\">" . $row['fra'] . "</a> - Den: " . $row['dato'] . "<p></td>
</tr>
<tr align=\\"left\\">
<td valign=\\"top\\">Besked:</td>
<td>" . $row['besked'] . "</td>
</tr>
</table><br><br>
</center>";
echo "<br><hr width=\\"490\\" size=\\"1\\"><p>";
}
$query = "SELECT COUNT(id) AS entrys FROM tagwall";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['entrys'];
$maxpage = ceil($numrows/$rowsPerPage);
$self = $_SERVER['PHP_SELF'];
$nav = '';
for($page = 1; $page <= $maxpage; $page++)
{
if($page == $pageNum)
{
$nav .= " $page ";
}
else
{
$nav .= "<a href='$self?page=$page'> $page </a>";
}
}
if ($pageNum > 1)
{
$page = $pageNum - 1;
$prev = " <a href='$self?page=$page'><strong>Tilbage</strong></a>";
$first = " <a href='$self?page=1'><strong>Første side</strong></a>";
}
else
{
$prev = '';
$first = '';
}
if ($pageNum < maxpage)
{
$page = $pageNum + 1;
$next = " <a href='$self?page=$page'><strong>Næste</strong></a>";
$last = " <a href='$self?page=$maxpage'><strong>Sidste side</strong></a>";
}
else
{
$next = '';
$last = '';
}
echo $prev ." ". $nav." ". $next;
?>