Hi, im working on some project on php with mysql, and I'm only actually a beginner in programming with php and mysql.
I created a table in mysql which contains several records. I have like 10 records in it. Now what I want to do is I only want to display 4 records from that table.
Here is the code on the query part. I stored it in an associative array.
<?php
$query_latestJobPost = "SELECT * FROM tbljobad ORDER BY postDate DESC";
$latestJobPost = mysql_query($query_latestJobPost, $dbConnection) or die (mysql_error());
$assoc_latestJobPost = mysql_fetch_assoc($latestJobPost);
$numberRows_latestJobPost = mysql_num_rows($latestJobPost);
?>
What happens if I use this code below, it displays the whole record which is stored in the table, but what I want is only to display a limited number of records.
<table>
<?php do { ?>
<tr>
<td><?php echo $assoc_latestJobPost['jobTitle']; ?></td>
<td><?php echo $assoc_latestJobPost['jobCategoryID']; ?></td>
<td><?php echo $assoc_latestJobPost['postDate']; ?></td>
<td><?php echo $assoc_latestJobPost['employerID']; ?></td>
</tr>
<?php }while($assoc_latestJobPost = mysql_fetch_assoc($latestJobPost)); ?>
</table>
What will I do to arrive with that output?