Code not lining properly

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Code not lining properly

Post 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?
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

Are you sure your topic is PHP relative?
Please clear all unnecessary and write your question in Client Side forum.
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Post by thefreebielife »

Yes, it is a PHP question.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post 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
Post Reply