Fejl med connect til mySQL ud fra et "lånt" script
Hejsa, jeg sidder og leger med et script fra macromedia.og det virker ikke, den laver denne fejl:
Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /hsphere/local/home/shafter/shafter.dk/vogn/products.php on line 11
Warning: mysql_query(): A link to the server could not be established in /hsphere/local/home/shafter/shafter.dk/vogn/products.php on line 11
Products
Product Price Description Add
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /hsphere/local/home/shafter/shafter.dk/vogn/products.php on line 43
og koden ser sådan her ud:
<?php
// This page will list all of the items
// from the items table. Each item will have
// a link to add it to the cart
include("db.php");
// Get a connection to the database
$cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);
$result = mysql_query("select * from items order by itemName asc");
?>
<html>
<head>
<title> Product List </title>
</head>
<body bgcolor="#ffffff">
<h1>Products</h1>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="30%" height="25" bgcolor="red">
<font face="verdana" size="1" color="white">
<b>Product</b>
</font>
</td>
<td width="10%" height="25" bgcolor="red">
<font face="verdana" size="1" color="white">
<b>Price</b>
</font>
</td>
<td width="50%" height="25" bgcolor="red">
<font face="verdana" size="1" color="white">
<b>Description</b>
</font>
</td>
<td width="10%" height="25" bgcolor="red">
<font face="verdana" size="1" color="white">
<b>Add</b>
</font>
</td>
</tr>
<?php
while($row = mysql_fetch_array($result))
{
?>
<tr>
<td width="30%" height="25">
<font face="verdana" size="1" color="black">
<?php echo $row["itemName"]; ?>
</font>
</td>
<td width="10%" height="25">
<font face="verdana" size="1" color="black">
$<?php echo $row["itemPrice"]; ?>
</font>
</td>
<td width="50%" height="25">
<font face="verdana" size="1" color="black">
<?php echo $row["itemDesc"]; ?>
</font>
</td>
<td width="10%" height="25">
<font face="verdana" size="1" color="black">
<a href="cart.php?action=add_item&id=<?php echo $row["itemId"]; ?>&qty=1">Add Item</a>
</font>
</td>
</tr>
<tr>
<td width="100%" colspan="4">
<hr size="1" color="red" NOSHADE>
</td>
</tr>
<?php
}
?>
<tr>
<td width="100%" colspan="4">
<font face="verdana" size="1" color="black">
<a href="cart.php">Your Shopping Cart >></a>
</font>
</td>
</tr>
</table>
</body>
</html>
Hvorfor siger den det? har os kigget i db.php men synes ikk der står noget galt der...
