Jump to content

Recommended Posts

:wtf: 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();

?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/182360-table-trouble/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/182360-table-trouble/#findComment-962514
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/182360-table-trouble/#findComment-962521
Share on other sites

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 .jitempics.thpg

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

Link to comment
https://forums.phpfreaks.com/topic/182360-table-trouble/#findComment-962525
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.