public/lib/library.php
/*
    * @author Derek Melchin
    * @abstract Add a tracklist to an album
    * @param array $tracklist List of track names for the album
    * @param int   $RefCode   Reference code of the album
    */
@author Derek Melchin
@abstract Add a tracklist to an album
@param array $tracklist List of track names for the album
@param int   $RefCode   Reference code of the album
@author Derek Melchin @abstract Add a tracklist to an album @param array $tracklist List of track names for the album @param int $RefCode Reference code of the album
public function addTracklist($tracklist, $RefCode) {
	if (count($tracklist) == 0)
	    return;
	$this->sanitizeStrings($tracklist);
	$values = "";
	foreach ($tracklist as $i => $trackName) {
	    if ($i > 0)
		$values .= ",";
	    $values .= "($RefCode, " . ($i + 1) . ", '$trackName')";
	}
	$this->mysqli->query(
		  "INSERT INTO tracklists "
			. "(library_RefCode, trackNum, trackName) "
		. "VALUES "
			. "$values;"
	);
    }
public function addTracklist ( $ tracklist , $ RefCode ) { if ( count ( $ tracklist ) == 0 ) return ; $ this -> sanitizeStrings ( $ tracklist ) ; $ values = " " ; foreach ( $ tracklist as $ i => $ trackName ) { if ( $ i > 0 ) $ values .= " , " ; $ values .= " ( $ RefCode ,  " . ( $ i + 1 ) . " , ' $ trackName ') " ; } $ this -> mysqli -> query ( " INSERT INTO tracklists  " . " (library_RefCode, trackNum, trackName)  " . " VALUES  " . " $ values ; " ) ; }
@author Derek Melchin
 @abstract Add a tracklist to an album
 @param array $tracklist List of track names for the album
 @param int   $RefCode   Reference code of the album
@author Derek Melchin @abstract Add a tracklist to an album @param array $tracklist List of track names for the album @param int $RefCode Reference code of the album
// Sanitize strings to prevent SQL injection // Create insertion rows string // Insert tracklist into database