I have made a mysql query, in to a php file and I want to do same thing but using JDatabase. Let's say for example, we have a table with two columns, column name and column image. Those two columns, contains ten rows. I want to make a list in my php code, that will render something like this:
Name | Image |
---------------------
AAAA | blahblah.png |
---------------------
BBBB | hahahaha.png |
---------------------
I have made it work using mysql but for some reasons, I should make it using JDatabase. Take an example on what I have now:
This is my query:
$query="SELECT m.name, l.image
FROM table1 AS m, table2 AS l
WHERE m.id BETWEEN 70 AND 80
AND l.id = 10
ORDER BY m.id ASC";
$result=mysql_query($query);
$num=mysql_numrows($result);
This is my php code:
<?php $count = 0; while ($count < $num){
$image = mysql_result($result,$count,"image"); ?>
<div><img src="'.$image.'"/></div><?php $count++;}?>
How can I do the same thing using JDatabase and not mysql?