i am working on a joomla module and i write this code for db connection and then fetch data from db and print it in a table
$db = JFactory::getDBO();
$query = $db->getQuery(true);
if($q == ""){
$query
->select(array('Stune_code,Stune_name,Stune_artist'))
->from('my_table')
->where('sub_cat_id = "4"')
->limit('$start, $per_page');
$query_pag_data = $db->loadObjectList();
$msg = "<table class='show-rslt'><tr>
<th class='tbl-header'>Song Title</th>
<th class='tbl-header'>Artist</th>
<th class='tbl-header'>Code</th>
</tr>";
while ($row = mysql_fetch_array($query_pag_data)) {
$msg .= "<tr>";
$msg .= "<td class='title'>" . htmlentities($row['Stune_name']) . "</td>";
$msg .= "<td class='title'>" . htmlentities($row['Stune_artist']) . "</td>";
$msg .= "<td class='title'>" . htmlentities($row['Stune_code']) . "</td>";
$msg .= "</tr>";
}
$msg .= "</table>";
$msg = "<div class='data'><ul>" . $msg . "</ul></div>"; // Content for Data
but it gives me this warning " Warning: mysql_fetch_array() expects parameter 1 to be resource, array given in C:"
then i debug it and use print_r() it gives me result like
Array
(
[0] => stdClass Object
(
[Stune_code] => 501348
[Stune_name] => xxx
[Stune_artist] => abc
)
[1] => stdClass Object
(
[Stune_code] => 501351
[Stune_name] => xxx
[Stune_artist] => abc
)
[2] => stdClass Object
(
[Stune_code] => 5011727
[Stune_name] => xxx
[Stune_artist] => asd
)
...
...
where am i wrong and what should i do to get the proper result