dm404 Posted April 30, 2008 Share Posted April 30, 2008 Hi everyone, bit of a newbie. Basically I can display images from mysql using script such as <img src=http://localhost/mywebsite/uploads/".$row['EventFlyer'] ."> However I can never get this to appear as an image in the below table. echo '<tr> <td align="left"><a href="editevent.php?EventID=' . $row['EventID'] . '">Edit</a></td> <td align="left"><a href="deleteevent.php?EventID=' . $row['EventID'] . '">Delete</a></td> <td align="left">' . $row['EventName'] . '</td> <td align="left">' . $row['EventDate'] . '</td> <td align="left">' . $row['EventTime'] . '</td> <td align="left">' . $row['EventPrice'] . '</td> <td align="left">' . $row['EventDescription'] . '</td> <td align="left">' . $row['EventFlyer'] . '</td> </tr> I know this only shows the file name, I've dabbled with inputting the image but it never works! Any help would be fantastic! Link to comment https://forums.phpfreaks.com/topic/103634-syntax-help-image-in-html-table-using-php/ Share on other sites More sharing options...
corbin Posted April 30, 2008 Share Posted April 30, 2008 ???? <td align="left"><img src=http://localhost/mywebsite/uploads/".$row['EventFlyer'] ."></td> Is that what you're looking for??? Link to comment https://forums.phpfreaks.com/topic/103634-syntax-help-image-in-html-table-using-php/#findComment-530689 Share on other sites More sharing options...
dooper3 Posted April 30, 2008 Share Posted April 30, 2008 corbin's right, notice how you have used "img src" before where you say it works, but not later on where you say it doesn't. img src is short for "image source" - if you don't tell the browser it's an image then it won't try and display it as one. Link to comment https://forums.phpfreaks.com/topic/103634-syntax-help-image-in-html-table-using-php/#findComment-530691 Share on other sites More sharing options...
dm404 Posted April 30, 2008 Author Share Posted April 30, 2008 I've tried that before, but get the error Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\xampp\htdocs\mywebsite\venue.php on line 701 Link to comment https://forums.phpfreaks.com/topic/103634-syntax-help-image-in-html-table-using-php/#findComment-530695 Share on other sites More sharing options...
DarkWater Posted April 30, 2008 Share Posted April 30, 2008 Show us...EXACTLY what you put. >_> Link to comment https://forums.phpfreaks.com/topic/103634-syntax-help-image-in-html-table-using-php/#findComment-530698 Share on other sites More sharing options...
dm404 Posted April 30, 2008 Author Share Posted April 30, 2008 The query is working ok as all the other fields are being populated a ok. Its just displaying the image within that's confusing me. echo '<table align="center" cellspacing="0" cellpadding="7"> <tr> <td align="left"><b>Edit</b></td> <td align="left"><b>Delete</b></td> <td align="left"><b>Name</b></td> <td align="left"><b>Date</b></td> <td align="left"><b>Time</b></td> <td align="left"><b>Price</b></td> <td align="left"><b>Description</b></td> <td align="left"><b>Flyer</b></td> </tr> '; // Fetch and print all the records while ($row = mysql_fetch_array($result7, MYSQL_ASSOC)) { echo '<tr> <td align="left"><a href="editevent.php?EventID=' . $row['EventID'] . '">Edit</a></td> <td align="left"><a href="deleteevent.php?EventID=' . $row['EventID'] . '">Delete</a></td> <td align="left">' . $row['EventName'] . '</td> <td align="left">' . $row['EventDate'] . '</td> <td align="left">' . $row['EventTime'] . '</td> <td align="left">' . $row['EventPrice'] . '</td> <td align="left">' . $row['EventDescription'] . '</td> <td align="left"><img src=http://localhost/mywebsite/uploads/".$row['EventFlyer'] ."></td> </tr> '; } echo '</table>'; mysql_free_result ($result7); // Free up the resources Cheers for the help it is much appreciated Link to comment https://forums.phpfreaks.com/topic/103634-syntax-help-image-in-html-table-using-php/#findComment-530701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.