this is "setting.inc" file
<?php
$DB_SERVER= "hilma";
$DB= "computer";
function DisplayErrMsg($message)
{
printf("<font size=5 color=#ff0000><b>%s</font>",$message);
}
function deleteCookies()
{
for($i=0; $i<$total_items;$i++)
{
setcookie("itemid[$i]","");
setcookie("quantity[$i]","");
}
setcookie("itemid");
setcookie("total_items");
setcookie("quantity");
}
?>
I'm learnig php on windows platform using PWS in stand alone computer.
$DB_SERVER= "hilma";>>>>> should be the name of my database server.
what should I write here.
I write the localhost name. but it still say error with the "setting.inc" everytime I was trying to run my php page.
?php
require "setting.inc";
if(!mysql_connect($DB_SERVER,$mycook_user,$mycook_passwd))
{
DisplayErrMsg(sprintf("internal error %d:%s\n",mysql_errno(),mysql_error()));
exit();
}
$statement="select itemid,name,price,stock from item order bu itemid";
if(!($result=mysql_db_query($DB<$statement)))
{
DisplayErrMsg(sprintf("internal error %d:%s\n",mysql_errno(),mysql_error()));
exit();
}
?>
<body bgcolor="#ffffff">
<p>
<font size="6">Administrative Tools</font>
</p>
<font color="#cc0033"><b>Browse : </b></font>
<a href="seeCust.php">Customers</a>
<a href="seeAllOrd.php">All Orders</a>
<a href="seeUnShipOrd.php">Unshipped Orders</a>
<a href="seeItem.php">Items</a><br>
<font color="#cc0033"><b>Adds : </b></font>
<a href="addItem.html">Items</a>
<font color="#cc0033"><b>Delete : </b></font>
<a href="delItem.php">Items</a><br>
<a href="logout.php">Logout</a><br>
<hr>
<h1>Browse Items</h1>
<table width=700 border=1>
<tr bgcolor="#99ffff">
<th width=50>ItemID</th>
<th width=400>Name</th>
<th width=150>Price</th>
<th width=100>Stock</th>
</tr>
<?php
while($row=mysql_fetch_array($result))
{
echo "<tr>\n";
echo "<td width=50>".$row["itemid"]."</td>\n";
echo "<td width=400>".$row["name"]."</td>\n";
echo "<td width=150>".$row["price"]."</td>\n";
echo "<td width=100>".$row["stock"]."</td>\n";
echo "<tr>\n";
}
?>
</table>
</body>
Thanks for your help. I'm the beginner🙂