user4fun Posted June 29, 2007 Share Posted June 29, 2007 This is beyond my php knowledge.I need $row['website'] value to be a hyperlink opened in a new page.and my image in the next <td> is wrong syntax.Please help in either one, while($row = mysql_fetch_array($result)) { echo "<td>" . $row['website'] . "</td>"; echo "<td>" img border="0" src="stars.jpg" width="163" height="30" "</td>";} Link to comment Share on other sites More sharing options...
vijay Posted June 29, 2007 Share Posted June 29, 2007 Hi.. you want to do if some one clicks on image then whatever come in $row['website'] via loop that would be open.. isn't it?if am right then you can do that bia following code:---------------------------------------------------------------------------------------------------------------<?phpwhile($row = mysql_fetch_array($result)) { echo "<td> <a href=\"".$row['website']."\" target=\"_blank\"> <img border=\"0\" src=\"stars.jpg\" width=\"163\" height=\"30\"> </a> <td>";}?>---------------------------------------------------------------------------------------------------------------Regards,Vijay Link to comment Share on other sites More sharing options...
yoshida Posted June 29, 2007 Share Posted June 29, 2007 Replace echo "<td>" img border="0" src="stars.jpg" width="163" height="30" "</td>"; with echo "<td><img src=\"stars.jpg\" border=\"0\" width=\"163\" height=\"30\"></td>"; If all images in that array will have the same size, you might want to define them as blocks using css td:img { display: block; width: x; height: y;} and just throw the image in there with <td><img src=\"stars.jpg\"></td> no success guaranteed tho. Link to comment Share on other sites More sharing options...
user4fun Posted June 29, 2007 Author Share Posted June 29, 2007 thank you, i wil.l try it out.It looks good, i think it will work Link to comment Share on other sites More sharing options...
user4fun Posted June 29, 2007 Author Share Posted June 29, 2007 thank you, i wil.l try it out. echo "<td><a href=\"".$row['website']."\" target=\"_blank\"></a><td>"; the image works great, the link to $row website is not working. The php file is ran fine but the website column comes up empty Link to comment Share on other sites More sharing options...
justsomeguy Posted June 29, 2007 Share Posted June 29, 2007 Put something before the </a><a href=\"".$row['website']."\" target=\"_blank\">{$row['website']}</a> Link to comment Share on other sites More sharing options...
user4fun Posted June 29, 2007 Author Share Posted June 29, 2007 PERFECT,thank you very muchthe only problem is the link end up beingwww.mydomain.com/$row websitei need it to bejust the $row website.lol Link to comment Share on other sites More sharing options...
justsomeguy Posted June 29, 2007 Share Posted June 29, 2007 Add http:// before the URL. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.