Hi,

I bind the below ID with javascript, but I'm not sure if it's the right method to do so?
The PHP:
Code:
while($row = $result->fetch_object()) {
     echo "<li>";
     echo "<div id=mp3Item>";
     echo "<div id=mp3Track>";
     echo $row->mp3_id;
     echo "</div>";
     echo "<div id=mp3Title>";
     echo $row->mp3_title;
     echo "</div>";
     echo "<div id=mp3Lenght>";
     echo $row->mp3_duration;
     echo "</div>";
     echo "</div>";
     echo "</li>";
}else{
     echo "<li>";
     echo "<div id=mp3Item>";
     echo "<div id=mp3Track>";
     echo 1;
     echo "</div>";
     echo "<div id=mp3Title>";
     echo "default song";
     echo "</div>";
     echo "<div id=mp3Lenght>";
     echo "04:01";
     echo "</div>";
     echo "</div>";
     echo "</li>";
     .
     .
     .
}
The javascript function plays the mp3 item when click.
Should I rename the id in the else {} and write new javascript function separately, what if my database expanded incrementally?