Jump to content


Photo

PHP and Arrays and Tables AAARRRGGGG


  • Please log in to reply
3 replies to this topic

#1 dragonstable

dragonstable
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 14 June 2006 - 11:17 AM

<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
<?php
include ("head.html");
?>
<!-- Table for Main Body -->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" align="left" width="91">
<?php
include ("menu.html");
?>
</td>
<td valign="top">


<center><h2>
<?php
print "$username";
?>'s Inventory
</center></h2>
<br>

<table align="center">
<?php
$dbh=mysql_connect ("********", "********", "********") or die ('I cannot connect to the database because: '

. mysql_error());
mysql_select_db ("dragonst_users");
$data = mysql_query("SELECT * FROM items WHERE user='$username'")
or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
Print '<td width="20%">';
Print "<center> ".$info['itemname'] . " <br>";
Print "<img src=http://dragonstable.fileplace.biz/".$info['image'] ."> <br>";
Print " ".$info['rarity'] . "</center></td>";
}
Echo '</table>';
?>


<br> <br>

</td>
<td width="1" valign="top"> </td>
</tr></table>

</body></html>



Basically thats my code i have at the moment, What i want it to do is show 5 entries from the array in the first row of the table, and then the next 5 entries in the next row and so on, so that way it doesnt scroll across the screen and keep going...

Please help, thanks in advance...

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 14 June 2006 - 11:41 AM

This question is asked all the time, henace, the answer is perminently posted [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=95426\" target=\"_blank\"]here[/a].

#3 dragonstable

dragonstable
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 18 June 2006 - 01:55 PM

thanks, had no idea it was sitting there...

#4 dragonstable

dragonstable
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 18 June 2006 - 02:06 PM

actually turns out i did read that before... it just confused me more though....




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users