Mcfarlin Posted November 21, 2009 Share Posted November 21, 2009 am i missing guys? i have been reading the forum for a few weeks and decided to join. i like the format and the advice given is great. anywho here is my table, the issue i have is that i am displaying pictures from a user on said users profile. pics of items they have within the site. they are showing fine, trouble is i cant seem to get them to wrap within the page, they are just making the page wider and wider when more pictures are added instead of wrapping and forming a group rather than a line of images screwing up the page dimensions. any tips of help, im at a total loss and at my wits end trying to make this work. $col=$db->query("SELECT iv.*,i.*,it.* FROM collections iv LEFT JOIN items i ON iv.collection_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.collection_userid={$r['userid']} ORDER BY i.itmtype ASC"); if ($db->num_rows($inv) == 0) { print "Member has not started a collection"; } else { print "<table width=100% class=\"table\" border=\"0\" cellspacing=\"1\">"; $lt=""; while($i=$db->fetch_row($col)) { if($lt!=$i['itmtypename']) { $lt=$i['itmtypename']; print "\n<tr><td><b>{$lt}</b></td></tr>"; } if ($i['inv_qty'] > 1) print"</td><td><img src='colpics/{$i['itmpic']}' height='120' width='120' title='{$i['itmdesc']}'>"; } } $h->endpage(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/182360-table-trouble/ Share on other sites More sharing options...
Mcfarlin Posted November 21, 2009 Author Share Posted November 21, 2009 correction print"</td><td><img src='colpics/{$i['itmpic']}' height='120' width='120' title='{$i['itmdesc']}'></td>"; } } $h->endpage(); ?> didnt have the tag closed. lol but that was not the problem Quote Link to comment https://forums.phpfreaks.com/topic/182360-table-trouble/#findComment-962346 Share on other sites More sharing options...
genericnumber1 Posted November 21, 2009 Share Posted November 21, 2009 http://www.phpfreaks.com/forums/index.php/topic,95426.0.html Quote Link to comment https://forums.phpfreaks.com/topic/182360-table-trouble/#findComment-962418 Share on other sites More sharing options...
Mcfarlin Posted November 21, 2009 Author Share Posted November 21, 2009 well i thought that might help, but sense i cannot post anything in that topic. this is what i have tried to use while taking that info into account. $query=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$r['userid']} ORDER BY i.itmtype ASC"); $result =($query); if($result && mysql_num_rows($result) > 0) { print "User has no items"; } else { print "<table cellspacing="3" cellpadding="3">"; $i = 0; $max_columns = 5; while($row = mysql_fetch_array($result)) { // make the variables easy to deal with extract($row); // open row if counter is zero if($i == 0) echo "<tr>"; // make sure we have a valid item if(($i['itmpic']) != "" && ($i['itmpic']) != null) echo "<td><img src='itmpics/{$i['itmpic']}' height='120' width='120'></td>"; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results //cleans up the code and makes the table valid if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } </tr> </table> $h->endpage(); ?> but i end up with Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' in /home/*******/public_html/viewuser1.php on line 223 the above code is lines 215 to 253 i am under the impression that T_LNUMBER was a reference to a variable though Quote Link to comment https://forums.phpfreaks.com/topic/182360-table-trouble/#findComment-962514 Share on other sites More sharing options...
cags Posted November 21, 2009 Share Posted November 21, 2009 Can we have a look at the generated HTML, the images appear to be in independent <td> tags, but not in <tr> tags, this means that the browser will keep placing the them next to each other in the same row. This will no doubt stretch your layout to the total width of all the images. Quote Link to comment https://forums.phpfreaks.com/topic/182360-table-trouble/#findComment-962521 Share on other sites More sharing options...
Mcfarlin Posted November 21, 2009 Author Share Posted November 21, 2009 Can we have a look at the generated HTML, the images appear to be in independent <td> tags, but not in <tr> tags, this means that the browser will keep placing the them next to each other in the same row. This will no doubt stretch your layout to the total width of all the images. $inv=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$r['userid']} ORDER BY i.itmtype ASC"); if ($db->num_rows($inv) == 0) { print "User has no items"; } else { print "<table width=75% class=\"table\" border=\"0\" cellspacing=\"1\">"; $lt=""; while($i=$db->fetch_row($inv)) { if($lt!=$i['itmtypename']) { $lt=$i['itmtypename']; print "\n<tr><td><b>{$lt}</b></td></tr>"; } if ($i['inv_qty'] > 1) print"</td><td><img src='itmpics/{$i['itmpic']}' height='120' width='120'></td>"; } } $h->endpage(); ?> equals .j while $query=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_userid={$r['userid']} ORDER BY i.itmtype ASC"); $result =($query); if($result && mysql_num_rows($result) > 0) { print "User has no items"; } else { print "<table cellspacing="3" cellpadding="3">"; $i = 0; $max_columns = 5; while($row = mysql_fetch_array($result)) { // make the variables easy to deal with extract($row); // open row if counter is zero if($i == 0) echo "<tr>"; // make sure we have a valid item if(($i['itmpic']) != "" && ($i['itmpic']) != null) echo "<td><img src='itmpics/{$i['itmpic']}' height='120' width='120'></td>"; // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results //cleans up the code and makes the table valid if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } </tr> </table> $h->endpage(); ?> results in Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' in /home/sitename/public_html/view.php on line 223 Quote Link to comment https://forums.phpfreaks.com/topic/182360-table-trouble/#findComment-962525 Share on other sites More sharing options...
cags Posted November 21, 2009 Share Posted November 21, 2009 Why quote my thread, then paste a load of code completely irrelevant/unrelated to what I asked for? Quote Link to comment https://forums.phpfreaks.com/topic/182360-table-trouble/#findComment-962527 Share on other sites More sharing options...
Mcfarlin Posted November 21, 2009 Author Share Posted November 21, 2009 guess i dont understand what the question is asking for then. i dont claim non nood status here. sorry bro. jsut started trying to learn two weeks ago. Quote Link to comment https://forums.phpfreaks.com/topic/182360-table-trouble/#findComment-962532 Share on other sites More sharing options...
cags Posted November 21, 2009 Share Posted November 21, 2009 I asked to see the HTML source. Load your page up in a browser click view source, copy the source and paste it in here. Quote Link to comment https://forums.phpfreaks.com/topic/182360-table-trouble/#findComment-962546 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.