Click to See Complete Forum and Search --> : Php help!!


stu007_uki
10-08-2007, 07:53 AM
Hi guys

I was wondering if anyone could help me, im designing a website for a mobile phone company, im trying to get my php code to show 9 records from my database into to php, and then give the customer an option to see all records, im not sure how i go about this can anyone help, the code below is what i have started and at the moment it shows all the records, i would really appreciate it for your input.

Cheers
Stuart

<head>
<script language="javascript">

var ie4 = false; if(document.all) { ie4 = true; }
function getObject(id) { if (ie4) { return document.all[id]; } else { return document.getElementById(id); } }
function toggle(link, divId) { var lText = link.innerHTML; var d = getObject(divId);
if (lText == '+') { link.innerHTML = '-'; d.style.display = 'block'; }
else { link.innerHTML = '+'; d.style.display = 'none'; } }
</script>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>

<body>
<div style="border: 0px solid #000000; padding: 0px; background: #FFFFFF; "><table border="0" cellspacing="0" cellpadding="2" width="100%" style="background: #f37b22; color: #FFFFFF; "><tr><td></td>
<td align="right">
<span class="style1"><a title="show/hide" id="exp1191585115_link" href="javascript: void(0);" onclick="toggle(this, 'exp1191585115');" style="text-decoration: none; color: #FFFFFF; font-size:18px; ">- </a>More Deals</span></td>
</tr></table>
<div id="exp1191585115" style="padding: 0px;"><table width="180" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="5"><img src="img/gen/spacer.gif" border="0" width="1" height="5" alt="Mark Down Mobiles" /></td>
</tr>
<tr>
<?php
$row = 0;
$end = 3;
while ($hotdeals = DB::fetch($result_hotdeals)) {
$obj = new PhoneBuilder();
if(PhoneBuilder::IsValid($hotdeals) == true) {
?>
<td width="180" class="hot_hld"><table width="180" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" class="hot_hdr"><?php echo UI::TabItems($hotdeals['HMake']) . " " . $hotdeals['HModel'] . " " . $valid; ?></td>
</tr>
<tr>
<td width="85" rowspan="2" class="hot_img"><?php CheckHandsetImage($hotdeals['HMake'], $hotdeals['HModel'], $hotdeals['HColour'], $hotdeals['HEdition'], $hotdeals['HRefurbished'], $hotdeals['PStockCode'], 82, 123, true); ?></td>
<td width="95" valign="top" class="hot_txt"><br />
<b>FREE <?php echo $hotdeals['ShortDesc']; ?></b><br />
<?php echo $hotdeals['TNetwork'] . " " . $hotdeals['TTariffName'] . " (" . $hotdeals['TContractLength'] . " Months)"; ?></td>
</tr>
<tr>
<td align="right"><img src="img/nwk/<?php echo UI::URLEncode($hotdeals['NetworkProvider']); ?>_thb.png" border="0" width="20" height="20" hspace="5" vspace="5" alt="Mobile Phones on <?php echo UI::TabItems($hotdeals['NetworkProvider']); ?>" /></td>
</tr>
<tr>
<td valign="top" class="hot_buy"><a href="javascript://" onclick="window.open('hotdealtac.php', '', 'status = 1, height = 310, width = 400, resizable = 0, scrollbars = 1')"> <img src="img/but/giftinfo.png" border="0" width="69" height="19" vspace="2" alt="Datasheet" /></a></td>
<td valign="top" class="hot_buy"><a href="process.php?action=hotdeal&id=<?php echo $hotdeals['OfferID']; ?>"><img src="img/but/buy.png" alt="Buy Now" width="69" height="19" border="0" /></a></td>
</tr>
</table></td>
<?php
$row++;
if($row == $end) {
$row = 0;
echo "</tr><tr><td colspan=\"5\"><img src=\"img/gen/spacer.gif\" border=\"0\" width=\"1\" height=\"10\" alt=\"Mark Down Mobiles\" /></td></tr><tr>";
} else {
echo "<td><img src=\"img/gen/spacer.gif\" border=\"0\" width=\"10\" height=\"1\" alt=\"Mark Down Mobiles\" /></td>";
}
}
}
echo "<td colspan=\"5\"><img src=\"img/gen/spacer.gif\" border=\"0\" width=\"10\" height=\"1\" alt=\"Mark Down Mobiles\" /></td>";
?>
</tr>
</table></div>
</div>
<script language="javascript">toggle(getObject('exp1191585115_link'), 'exp1191585115');</script>
<td width="180" class="hot_hld">&nbsp;</td>

</body>
</html>

\\.\
10-08-2007, 08:05 AM
1. wrap your code in tags so its easier to read
2. what database are you using?
3. where is the database query?

As your requesting information about getting data out of your database, it isn't PHP forum that you need to be talking to either... although their is a crossover between the two, your inital query is database and the latter php.