Page 1 of 1

Code not lining properly

Posted: Tue Jun 26, 2007 8:21 am
by thefreebielife

Code: Select all

	<?
$ref = $_GET['r'];
if ($_GET['r'] != "") {
	$rid = $_GET['r'];
}
//select the table
$result = mysql_query("select * from gifts order by gId");
$i = 1;
//grab all the content
while($r=mysql_fetch_array($result))
{	
	$gid=$r["gId"];
	$gname=$r["gName"];
	$gdescription=$r["gDescription"];
	$gimage=$r["gImage"];
	$gprice=$r["gPrice"];

	?>
	<Td>
	<Table style="width:200px "><tr><td><div class="top"><div class="gimage" align="center"><img src="<? echo "$gimage"; ?>" border="0"></div></td></tr>
	<tr><td align="center"><div class="gname"><? echo "$gname"; ?></div></td></tr>
	<tr><td><div class="gdescription"><? echo stripslashes($gdescription); ?></div></td></tr>
	<tr><td><div class="gprice" align="left"><font color="#000000">Price:</font> $<? echo "$gprice"; ?><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="register.php?gid=<? echo "$gid"; ?>&&r=<? echo "$rid"; ?>"> Get It Free</a>>></font><font color="#FF9900" style="font-weight:bold "></font>  </div></td></tr>
	</Table>
	</Td>



	<? 
	if ($i % 3 == 0) { echo "</tr><tr>"; } 
	$i++;
}
?>
Before I had this code on an image sliced web layout, but when i tried it on a 100% CSS based layout, its not functioning properly. What i would like it to do, after 3 images in a row, start a whole new row. Any suggestions?

Posted: Tue Jun 26, 2007 8:26 am
by Gente
Are you sure your topic is PHP relative?
Please clear all unnecessary and write your question in Client Side forum.

Posted: Tue Jun 26, 2007 8:28 am
by thefreebielife
Yes, it is a PHP question.

Posted: Tue Jun 26, 2007 11:44 am
by superdezign
Image-sliced layout = bad. Tables and CSS don't mix very well. Also:
thefreebielife wrote:

Code: Select all

<td><div class="top"><div class="gimage" align="center"><img src="<? echo "$gimage"; ?>" border="0"></div></td>
Your code opens two divs, then closes one.
thefreebielife wrote:

Code: Select all

<a href="register.php?gid=<? echo "$gid"; ?>&&r=<? echo "$rid"; ?>">
You have two ampersands in your link before the second variables.
thefreebielife wrote:

Code: Select all

Get It Free</a>>></font>
You have two random greater than signs (>).

And last but not least, you actually use the <font> element. This is hardly a PHP problem: this is just bad HTML. Fix it up! :P