Jump to content

output mysql query in a table


jobs1109

Recommended Posts

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

<?php do{

:wtf:

 

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.

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.