Loading…

Listing

[insert_php]

$type=$_GET[‘type’];

if (isset($type)) {

$connect = mysql_connect(“localhost”,”fmojhvmy_inst”,”P@55W0rd”); // connection location to the db or display error
$db = @mysql_select_db(“fmojhvmy_inst”,$connect); // connecting to the database or display error message

$sql = “SELECT * FROM `instrument` WHERE `instrument_type` = $type ORDER BY hmmf_number ASC”;
$result = mysql_query($sql);

$sql1 = ‘SELECT name FROM `instrument_type` WHERE `id` = ‘.$type;
$result1 = mysql_query($sql1);

if ($row1 = mysql_fetch_array($result1)) {
// DUMP OUT the contents of the above query to vars
$name = $row1[‘name’];
} else { }

echo ‘

Instrument Collection – ‘.$row1[‘name’].’

Go Back

‘;

$i=1;
while ($row = mysql_fetch_array($result)) {

if ($i % 2) { $css = “odd gradeU”;} else { $css = “even gradeU”;}
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;

$sql2 = ‘SELECT thumbs_location FROM instrument_pictures WHERE instrument_id = ‘.$row[‘id’].”;
$result2 = mysql_query($sql2) or perish (“Unable to execute SQL query on database ::
rn” . mysql_error());

echo ‘

“;
$i = ++$i;
}

echo ‘

ID Type Key Orientation Thumbnail/Info
‘.$row[‘hmmf_number’].’ ‘.get_proper_name($row[‘instrument_type’], “name”, “instrument_type”).’ ‘.get_proper_name($row[‘key’], “type”, “instrument_key”).’ ‘.get_proper_name($row[‘orientation’], “type”, “instrument_orientation”).’ ‘;
while ($row2 = mysql_fetch_array($result2)) {
echo ‘‘;
}

echo “

ID Type Key Orientation Thumbnail/Info

‘;
} else { echo ‘No instrument selected. Back to Instruments‘; }

function get_proper_name($val, $fld, $tbl) {
$html = “”;
$result = mysql_query($sql = “SELECT $fld FROM $tbl WHERE `id` = ‘$val'”);
while ($row = mysql_fetch_array($result)) {
$html .= $row[$fld];
}
return $html;
}

[/insert_php]