Sound Samples
If you have a good database of free samples or know of one currently up on the net somewhere, let us know and we’ll add it.
If you send us some samples to put up, we’ll link to your website from each of the samples!
Here are the current categories, enjoy:
“;
$username = DB_USER;
$password = DB_PASSWORD;
$hostname = DB_HOST;
$dbname = DB_NAME;
$mysqli = new mysqli($hostname, $username, $password, $dbname);
if ( $mysqli->connect_errno )
{
echo ‘Sorry, unable to get content.’;
}
else
{
$sql = “SELECT DISTINCT(category) AS category FROM Samples “;
$results = $mysqli->query($sql);
$categories = array();
if ( $results->num_rows )
{
while ($row = $results->fetch_assoc())
{
$categories[] = str_replace(‘ ‘,’_’, $row[‘category’]);
}
}
$id = isset($_GET[‘id’]) ? intval($_GET[‘id’]) : null;
$page = isset($_GET[‘category_page’]) ? intval($_GET[‘category_page’]) : null;
$selected_category = isset($_GET[‘category_name’]) && in_array($_GET[‘category_name’], $categories) ? $_GET[‘category_name’] : null;
if ( ! $id && ! $selected_category )
{
echo $page_description;
foreach ($categories as $category)
{
$category_name = str_replace(‘_’,’ ‘, $category);
echo ‘
>> ‘.$category_name.’‘;
}
}
else
{
$selected_category = str_replace(‘_’,’ ‘,$selected_category);
if ( $id )
{
$sql = “SELECT filename, description, category, size FROM Samples WHERE filename = ‘”. intval($id) .”‘”;
$results = $mysqli->query($sql);
$display_category = null;
$output = “
Sample Name: | ‘.$row[‘description’].’ |
Category: | ‘.$row[‘category’].’ |
Size: | ‘.$row[‘size’].’k |
Download Link: | download |
“;
$category_url = str_replace(‘ ‘,’_’,$display_category);
echo ‘
Categories :: ‘.$display_category.’
‘;
echo $output;
}
else
{
$page = $page ? intval($page) : 1;
$pagesize = 50;
$startrecord = ($page – 1) * $pagesize + 1;
echo ‘
Categories :: ‘.$selected_category.’
‘;
$sql=”SELECT filename, description, size FROM Samples WHERE category = ‘”. $mysqli->real_escape_string($selected_category) .”‘ LIMIT “.$startrecord.”,”.$pagesize;
$results = $mysqli->query($sql);
$count = 0;
while ($row = $results->fetch_assoc())
{
echo ‘‘.$row[‘description’].’ (‘.$row[‘size’].’k)
‘;
$count = $count + 1;
}
$previous_page = $page – 1;
if ( $previous_page >= 1)
{
echo ‘
‘;
}
if ($count > 49)
{
$next_page = $page + 1;
echo ‘
‘;
}
}
}
$results->free();
$mysqli->close();
}
?>