razvypp Posted April 6, 2010 Share Posted April 6, 2010 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 More sharing options...
conker87 Posted April 6, 2010 Share Posted April 6, 2010 Can we have a link to the live site? Link to comment https://forums.phpfreaks.com/topic/197740-php-mysql-inventory-help/#findComment-1037735 Share on other sites More sharing options...
razvypp Posted April 6, 2010 Author Share Posted April 6, 2010 http://heroes.fnhost.org/index.php login with razvypp/gameszone when you login there will be a floating div , and under it says your inventory is the table . hope this is what u asked . Link to comment https://forums.phpfreaks.com/topic/197740-php-mysql-inventory-help/#findComment-1037737 Share on other sites More sharing options...
conker87 Posted April 6, 2010 Share Posted April 6, 2010 Still not really sure what you want to do. Link to comment https://forums.phpfreaks.com/topic/197740-php-mysql-inventory-help/#findComment-1037741 Share on other sites More sharing options...
razvypp Posted April 6, 2010 Author Share Posted April 6, 2010 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 ! Link to comment https://forums.phpfreaks.com/topic/197740-php-mysql-inventory-help/#findComment-1037744 Share on other sites More sharing options...
Pikachu2000 Posted April 6, 2010 Share Posted April 6, 2010 So, you want to display a table with 30 fields regardless of how many records are returned in the DB query, is that correct? Link to comment https://forums.phpfreaks.com/topic/197740-php-mysql-inventory-help/#findComment-1037766 Share on other sites More sharing options...
razvypp Posted April 6, 2010 Author Share Posted April 6, 2010 Yes that is corect Link to comment https://forums.phpfreaks.com/topic/197740-php-mysql-inventory-help/#findComment-1037768 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.