jobs1109 Posted August 26, 2011 Share Posted August 26, 2011 Hi, I am trying to get this Mysql results in a table Here is the output <table width="500"> <tr><td><center><img border="0" src="http://www.hiringinhilo.com/Hilo-Jobs/Hilo-Logo/job-search-results-top.gif"><center><br><br></td></tr> <tr><td> <?php do {?> <p><a href="http://www.hiringinhilo.com/Hilo-Jobs/Job-Search-Form/Getting-Data-From-Database/Job-Details/Job-Details.php?id=<?php echo $rsjobs['id'];?>" target="new"><?php echo $rsjobs['JobTitle']; ?></a> <?php echo date("m/d/Y",strtotime($rsjobs['PostedOnDate'])); ?> <?php echo $rsjobs['State'];?> <?php echo $rsjobs['JobType'];?> <?php } while ($rsjobs=mysql_fetch_assoc($jobs_query)) ?> </td></tr> </table> </center> How do I get this to print out in a table like Job title Date Posted State Job type Thanks Link to comment https://forums.phpfreaks.com/topic/245767-output-mysql-query-in-a-table/ Share on other sites More sharing options...
Muddy_Funster Posted August 26, 2011 Share Posted August 26, 2011 <?php do{ here, try this: <?php echo '<img border="0" src="http://www.hiringinhilo.com/Hilo-Jobs/Hilo-Logo/job-search-results-top.gif">'; echo '<table width="500">'; echo'<tr><th>Job Title</th><th>Date Posted</th><th>State</th><th>Job Type</th></tr>'; while ($rsjobs=mysql_fetch_assoc($jobs_query)){ echo '<tr><td>'; echo '<td><a href="http://www.hiringinhilo.com/Hilo-Jobs/Job-Search-Form/Getting-Data-From-Database/Job-Details/Job-Details.php?id=<'.$rsjobs['id'].' target="new">'.$rsjobs['JobTitle'].'</a></td>'; $date = date("m/d/Y",strtotime($rsjobs['PostedOnDate'])); echo '<td>'.$date.'</td>'; echo '<td>'.$rsjobs['State'].'</td>'; echo '<td>'.$rsjobs['JobType'].'</td>'; echo '</tr>'; } echo '</table>'; I have to assume you have assigned the value to $job_query outwith the code you have provided. Link to comment https://forums.phpfreaks.com/topic/245767-output-mysql-query-in-a-table/#findComment-1262439 Share on other sites More sharing options...
jobs1109 Posted August 27, 2011 Author Share Posted August 27, 2011 Hi thanks for helping but I am getting an error message. Here is the code i have now <center> <?php do{ <?php echo '<img border="0" src="http://www.hiringinhilo.com/Hilo-Jobs/Hilo-Logo/job-search-results-top.gif">'; echo '<table width="500">'; echo'<tr><th>Job Title</th><th>Date Posted</th><th>State</th><th>Job Type</th></tr>';while ($rsjobs=mysql_fetch_assoc($jobs_query)){echo '<tr><td>'; echo '<td><a href="http://www.hiringinhilo.com/Hilo-Jobs/Job-Search-Form/Getting-Data-From-Database/Job-Details/Job-Details.php?id=<'.$rsjobs['id'].' target="new">'.$rsjobs['JobTitle'].'</a></td>';$date = date("m/d/Y",strtotime($rsjobs['PostedOnDate'])); echo '<td>'.$date.'</td>'; echo '<td>'.$rsjobs['State'].'</td>'; echo '<td>'.$rsjobs['JobType'].'</td>';echo '</tr>';}echo '</table>'; } ?> </center> and here is the error message Parse error: syntax error, unexpected '<' in /home/content/h/i/l/hilo103/html/Hilo-Jobs/Job-Search-Form/Getting-Data-From-Database/Getting-Data-Database4.php on line 51 Link to comment https://forums.phpfreaks.com/topic/245767-output-mysql-query-in-a-table/#findComment-1262493 Share on other sites More sharing options...
fenway Posted August 28, 2011 Share Posted August 28, 2011 This is the wrong forum for parsing errors. Link to comment https://forums.phpfreaks.com/topic/245767-output-mysql-query-in-a-table/#findComment-1262716 Share on other sites More sharing options...
Muddy_Funster Posted August 30, 2011 Share Posted August 30, 2011 You've done it again. Delete the line <?php do { Link to comment https://forums.phpfreaks.com/topic/245767-output-mysql-query-in-a-table/#findComment-1263427 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.