Shadowbudz Posted March 18, 2013 Share Posted March 18, 2013 Hi PHP Gurus, I am newbie to HTML and PHP, i would like a help about how to properly put an image in my table. I have a table working properly that gets data(texts) and puts in the database and retrieves it and display it in a table. Now my main concern is to put images in a certain row but my problem is the image keeps on repeating in the rows. Sorry for my english. Here is a picture so you can see the table. http://img571.imageshack.us/img571/4968/imagexf.png Here is my code on the table. //READ ALL POSTS $records = read_(0); ?> <table style="width:100%; border: 1px solid #b7ddf2; background-color: black;"> <tr style='background-color: #A00000; height: 30px;'> <th>Team</th> <th>vs</th> <th>Team</th> <th>Date</th> <th>Venue</th> <th>Channel</th> <th width='100px'></th> </tr> <?php $count=0; $style1="style= 'background-color: blue'"; $style2="style= 'background-color: blue'"; //DISPLAY ALL POSTS while ($record = mysql_fetch_array($records)) { if ($count%2==0) $style = $style1; else $style = $style2; echo "<tr $style>"; echo "<td><image src ='heat logo.jpg'/></td>"; //problem here echo "<td width ='30px'></td>"; echo "<td width ='160px'><img src ='knicks logo.jpg'/></td>"; //problem here echo "<td>".$record['date']."</td>"; echo "<td>".$record['venue']."</td>"; echo "<td>".$record['channel']."</td>"; echo "<td width='120px'><a href='edit.php?id=".$record["id"]."' class='button2'>edit</a> <a href='delete.php?id=".$record["id"]."' class='button2'>delete</a> </td>"; echo "</tr>"; $count++; } ?> </table> My problem is how to put different image in that specific row and avoid the repetition of the images. i tried using echo "<td><image src ='heat logo.jpg'/> <image src ='lakers logo.jpg'/> </td>"; but the image just goes side by side instead of going to another row and the image still repeats every row. Here is the image http://img685.imageshack.us/img685/7452/image2rc.png Any help would be greatly appreciated. Shadowbudz Quote Link to comment Share on other sites More sharing options...
deadlyp99 Posted March 18, 2013 Share Posted March 18, 2013 (edited) Your using the same images repeatedly. Your while loop repeats, and keeps using the static image url. You can restructure your database to also contain the image url for a specific team. echo "<td><image src ='".$record['teamOneImageUrl']."'/></td>"; //problem here echo "<td><image src ='".$record['teamTwoImageUrl']."'/></td>"; //problem here Edited March 18, 2013 by deadlyp99 Quote Link to comment 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.