Code sample
This trivial PHP script returns a list of all chords in the DB
Confidential details have been altered
<?
include("hidden.inc");
connect() or die("Connection failed");
$query = "select root, type, pos, shape, fingering "
. "from description, chord, fingering "
. "where description.id = chord.description_id "
. "and chord.id = fingering.chord_id";
$result = mysql_query($query) or die("Query failed");
print("<table border=1>\n");
print ("<tr>\n");
print("\t<th>root</th>\n");
print("\t<th>type</th>\n");
print("\t<th>pos</th>\n");
print("\t<th>shape</th>\n");
print("\t<th>fingering</th>\n");
print("</tr>\n");
while ($row = mysql_fetch_row($result))
{
print ("<tr>\n");
for ($i = 0; $i < mysql_num_fields($result); $i++)
{
printf("\t<td>%s</td>\n", htmlspecialchars($row[$i]));
}
print("<tr>\n");
}
print("</table>\n");
mysql_free_result($result);
?>