I am building a form so I can select multiple items from the same data. I am getting the data from the db but I am running into issues with the output not incrementing. Here is what I have:
<?
$sql_a="SELECT * FROM $tablename order by date DESC";
$result_a = @($sql_a, $connection) or die(mysql_error());
$num_rows_a = mysql_num_rows($result_a);
for ($i = 1; $i <= $num_rows_a; $i++) {
//echo"$num_rows_a";
//echo"$i";
if (mysql_num_rows($result_a) >0 ) {
while ($row_a = mysql_fetch_array($result_a)) {
$ida = $row_a['id'];
$datea = $row_a['date'];
$titlea = $row_a['title'];
$date_a = date("n j, Y", strtotime($datea));
$alist .="<input name=\"audio$i\" type=\"radio\" value=\"$ida\">$date_a $titlea<br>";
}
}
}
?>
$i before the while loop will show 1234 (4 rows so far), but the audio$i is only showing 1. I have tried the for loop inside the while loop and that is not working.
I am sure this is an easy fix for someone with more experience in this area.
Thanks in advance.
Matt