Jump to content

[SOLVED] syntax writing data outside of <tr>


Q695

Recommended Posts

look for "//outside <tr>":

<?php
$sql="SELECT * FROM inventory WHERE user='$id'";
$result=@mysql_query($sql,$con) or die(death($sql));
$inv=mysql_num_rows($result);

while ($row=mysql_fetch_array($result)){
echo"
  <tr>
<td bgcolor='#003300' align='center' width='100' height='100'>".item($row[item])."</td>";//outside <tr>

$row=mysql_fetch_array($result);
echo"
<td bgcolor='#003300' align='center' width='100' height='100'>item($row[item])</td>";

$row=mysql_fetch_array($result);
echo"<td bgcolor='#003300' align='center' width='100' height='100'>item($row[item])</td>
  </tr>";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/165575-solved-syntax-writing-data-outside-of/
Share on other sites

and why is it putting the html outside of the top <tr>?

 

if you need help, here is the html output:

	<table border="0" cellspacing="20" cellpadding="0">
<a href='?page=transfer&item=1'><img src='images/items/WoodSword.jpg' width='100' height='100' border='0'></a>
  <tr>
<td bgcolor='#003300' align='center' width='100' height='100'></td>
<td bgcolor='#003300' align='center' width='100' height='100'></td><td bgcolor='#003300' align='center' width='100' height='100'></td>
  </tr></table>

 

I was calling fetch 3 times to save time coding (lazyness to get out the prototype face site game).

 

 

and why is it putting the html outside of the top

?

I still don't understand your question

I was calling fetch 3 times to save time coding.

That won't work....for the simple fact that you typed it three times proves that.

 

 

This would perfectly suffice.

echo "";
while ($row=mysql_fetch_array($result)){
echo "".item($row[item])."";
}
echo "";

I am also doing the while loop the way I am because it's like a backpack.

 

I want "<a href='?page=transfer&item=1'><img src='images/items/WoodSword.jpg' width='100' height='100' border='0'></a>" to be included inside the top <td>.

 

I don't really know how to do the <div> table method beside the single line method.

 

I looked at how I did it in a different section, which is dirtier, but it works.

<?php
$sql="SELECT * FROM inventory WHERE user='$id'";
$result=@mysql_query($sql,$con) or die(death($sql));

while ($row=mysql_fetch_array($result)){?>
  <tr>
<td bgcolor='#003300' align='center' width='100' height='100'><?php item($row[item])?></td>


<?php $row=mysql_fetch_array($result); ?>
<td bgcolor='#003300' align='center' width='100' height='100'><?php item($row[item])?></td>

<?php $row=mysql_fetch_array($result); ?>
<td bgcolor='#003300' align='center' width='100' height='100'><?php item($row[item])?></td>
  </tr>
<?
}
?>

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.