I have an assignment to do and am stuck.
the question is:
Modify findTrack.php to ensure that no more than 2 tracks from any artist are contained in a single playlist. Provide a suitable error message where appropriate.
The code i have so far is:
[php]<?php
include(“dbConnect.php”);
$playlistID=$_REQUEST[“playlistID”];
$playlistTrackID=$_REQUEST[“playlistTrackID”];
if (isset($_GET[“artist”])) {
$artistID=$_GET[“artist”];
// add code here to ensure that we do not already have 2 tracks by the
// selected artist already entered into this playlist (1a)
echo “
Choose an album
”;$dbQuery=$db->prepare(“select * from albums where artistID=:artistID”);
$dbParams=array(‘artistID’=>$artistID);
$dbQuery->execute($dbParams);
echo “<div class=“bigMargin”>”.
“
- ”;
- $albumTitle ”;
while ($dbRow = $dbQuery->fetch(PDO::FETCH_ASSOC)) {
$albumTitle=$dbRow[“title”];
$albumID=$dbRow[“id”];
echo “
}
echo “
“”;[/php]
thanks