yellowepi Posted April 24, 2007 Share Posted April 24, 2007 I am new to programming and have been figuring most of what I know out by reading, but I have spent too much time trying to figure this out. I am trying to pull information from a mysql database to display an image or create a link and have not been able to get either to work. <?php echo "<table border = 1>"; $query_row=mysql_num_rows($result); while ($row=mysql_fetch_array($result)) { echo "<tr> <td>" "<a href= "\" .$row[item_title] "\">".$row[item_title] . "</a></td> <td>" .$row[item_desc] . "</td> <td>" .$row[item_price] . "</td> </tr>"; } echo "</table>"; ?> I've attempted to insert an image in a similar fashion, but haven't been able to. Thanks Link to comment https://forums.phpfreaks.com/topic/48483-solved-inserting-a-variable-into-an-html-element/ Share on other sites More sharing options...
xenophobia Posted April 24, 2007 Share Posted April 24, 2007 echo "<table border = 1>"; $query_row=mysql_num_rows($result); while ($row=mysql_fetch_array($result)) { ?> <!-within here will be inside the loop area--> <tr> <td><a href="<?php echo $row['item_title']; ?>"></a></td> <td><?php echo $row['item_desc']; ?></td> <td><?php echo $row['item_price']; ?></td> </tr> <!-within here will be inside the loop area--> <?php } echo "</table>"; With this, maybe you can see more clearer what is inside your HTML tag. Link to comment https://forums.phpfreaks.com/topic/48483-solved-inserting-a-variable-into-an-html-element/#findComment-237088 Share on other sites More sharing options...
yellowepi Posted April 24, 2007 Author Share Posted April 24, 2007 thankyou, saved me more frustration. I also added on more line to get the link to work, because there wasn't any clickable link. I took your advice for that also, and it worked. <td><a href="<?php echo $row['item_title'];?>"><?php echo $row['item_title']; ?></a></td> Link to comment https://forums.phpfreaks.com/topic/48483-solved-inserting-a-variable-into-an-html-element/#findComment-237109 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.