Jump to content

Php mysql inventory help


razvypp

Recommended Posts

Hy guyz if u could please help me ,

i want to make a table lets say 6x6

 

and in each <td></td> i want to put a value from the database , i managed to do something for the moment but not what i wanted :( cause after finishing the values in the database the tables stops and doesn't finish the table with the empty td's. I know code is wrong and don't have repetitive structures  if some on can help me .

 

print"<table><tr>";

//------------------------

$query = "SELECT * FROM inventory WHERE ownerid=".$x;

$nt = mysql_query($query); echo mysql_error();

$k=1;

//------------------------

while($row = mysql_fetch_array($nt))

{

$y= $row['itemid'];

$query2 = "SELECT * FROM items WHERE itemid=".$y;

$nt2 = mysql_query($query2); echo mysql_error();

$row2 = mysql_fetch_array($nt2);

if ($row['number']>0 && $k<=6)

{

print "<td style='background-image:url(img/buttons/buble.png);background-repeat:norepeat;' ><a href='inv2.php?id=$row[id]&itd=$y'><img src='$row2[icon]' /></a>";print "</td>";

$k++;}

if($k>6)

{ print "</tr><tr>";

$k=1;}

}

print"</tr></table>";

 

Link to comment
https://forums.phpfreaks.com/topic/197740-php-mysql-inventory-help/
Share on other sites

ok i will try to explain lets say in the database i have 7 records  ex: 1,2,3,4,5,6,7

 

i want to output a table like this , each value to be fetched from the database:

 

(1)(2)(3)(4)(5)(6)

(7)( )( )( )( )( )

( )( )( )( )( )( )

( )( )( )( )( )( )

( )( )( )( )( )( )

 

it's like this

http://www.phpfreaks.com/forums/index.php/topic,292443.msg1384149.html#msg1384149

but no one solved it !

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.