Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hi All,
I'm a bit new to php and I'm working on random recordsets for a shopping site. My random script works great and pulls info from my datatbases perfectly BUT i'm getting some weird stuff with my prices. For some reason my prices have extra 0's added to the end.
This is my code...Code: Select all
<?php require_once('Connections/petgiftshop.php'); ?>
<?php
mysql_select_db($database_petgiftshop, $petgiftshop);
$query_Recordset1 = "SELECT * FROM products";
$Recordset1 = mysql_query($query_Recordset1, $petgiftshop) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php $query = "SELECT * products";
$result = MYSQL_QUERY($query);
$randval = rand(0, mysql_num_rows($Recordset1) - 1);
$title = mysql_result($Recordset1, $randval, 27);
$image = mysql_result($Recordset1, $randval, 19);
$price2 = mysql_result($Recordset1, $randval, 13);
$price = mysql_result($Recordset1, $randval, 12);
$description = mysql_result($Recordset1, $randval, 30);
$id = mysql_result($Recordset1, $randval, 0);
echo strtolower($row_Recordset1['$image']);
print("<p class='headerbold'>$title</p>
<img src='http://www.petgiftshop.com/images/products/$image.jpg' width='100' height='100'>
<p class='copy'>$description</p>
<span class='copyboldheader'>Product Details</span>
<hr>
<span class='copybold'>Unit Price : <s>$$price2</s> <span class='copyboldred'>$$price</span> <br>
<a href='http://www.petgiftshop.com/index.php?p=product&id=$id' target='_blank' class='copy'>Te ll me more! </a>"
);
?>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>ItaltrendFaux Leopard Coat for Dogs
<IMAGE>
The reverse side of this coat is Gold Discodot. We have just developed a new line of faux fur coats for dogs. They were designed in Italy where we have our origins, but are manufactured in Las Vegas inhighly specialized labs under our constant control. The materials have been accurately selected among the very best and the look is extremely close to real furs. The reverse material is the latest in design of high fashion for ladies. Our garments are reversible and extremely elegant on both sides. Each garment is accurately hand sewn in all detailsfor a quality look.
Product Details
------------------------------------------------------------------------
Unit Price : $0.00000 $88.00000 <-----Any idea why these are coming from?
Te ll me more!
Any and all help is greatly appreciated. Thank You.
patrikG | Help us, help you. Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]