Jump to content


Help in putting image in Table

  • Please log in to reply
1 reply to this topic

#1 Shadowbudz

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 18 March 2013 - 04:54 AM

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. 




Here is my code on the table.


	$records = read_(0);

    <table style="width:100%; border: 1px solid #b7ddf2; background-color: black;">	
	<tr style='background-color: #A00000; height: 30px;'>
		<th width='100px'></th>
	$style1="style= 'background-color: blue'";
	$style2="style= 'background-color: blue'";
	while ($record = mysql_fetch_array($records)) {
		if ($count%2==0)
			$style = $style1;
			$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>";


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.images...52/image2rc.png



Any help would be greatly appreciated.



#2 deadlyp99

  • Members
  • PipPipPip
  • Advanced Member
  • 124 posts

Posted 18 March 2013 - 09:51 PM

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 by deadlyp99, 18 March 2013 - 09:52 PM.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users