I have this code which takes data from an sqlite3 database and prints out the all the data from the data into an html table. Like so:
1 jake asdlfj lakdsjfl lkajsdgklj kafdlgjkalg 2011-12-04
2 Bill asdfohdf oijasdofij qoasjgfoiq oaisjdfae 2011-12-04
3 Tim lakdsfgaie aogoie ;lasjdlo asdfgae 2011-12-04
4 hello adfase wqer qwtwt wqerwqer 2011-12-05
The data in the table is just random typing to see if it works. Anyways what I want to do is to only print out one row of the table to be printed out. I want to be able to call the function and grab the row i need and print out only that row on my webpage. I can't seem to find a php function to do this. Only one's that take an array of the rows and prints out the entire thing. Can someone help. My code is below.
<?php
function display()
{
$db = new SQLite3('jobs.db');
$sql = "SELECT * FROM jobs";
$result = $db->query($sql);//->fetchArray(SQLITE3_ASSOC);
while($res = $result->fetchArray(SQLITE3_ASSOC)){
echo "<table border=1>";
echo "<tr><td>";
echo $res['id'];
echo "</td><td>";
echo $res['jobtitle'];
echo "</td><td>";
echo $res['employer'];
echo "</td><td>";
echo $res['location'];
echo "</td><td>";
echo $res['email'];
echo "</td><td>";
echo $res['description'];
echo "</td><td>";
echo $res['date'];
echo "</td></tr>";
echo "</table>";
}
}
?>