Hello All,
I have the following code, it works fine but I'm sure there is a more efficiant way of doing this. Could anyone give me some advice ?
Note that this code is for flash action script to handle. The output must be used as the echo statements at the end.
I have tried searching the forum and google for functions and using arrays with the sql below but didnt really know what to search for.
<?php
$link_chord = "3|C,0|C,5|C,3";
$link_chord_explode = explode("|", $link_chord);
$chord_amount = $link_chord_explode[0];
$x = 1;
include ("dbconnect.php");
while ($x < $chord_amount + 1) {
$chord = $link_chord_explode[$x];
$chord = explode(",", $chord);
$chord_name = $chord[0];
$chord_number = $chord[1];
$query = "SELECT * from chords where chord = '$chord_name' and chord_number = '$chord_number'";
$fetch = mysql_query("$query") or die("Select Failed!");
$sql = mysql_fetch_array($fetch);
$chord_name = $sql['chord'];
$chord_number = $sql['chord_number'];
$position = $sql['position'];
$fingers = $sql['fingers'];
echo "chord_name$x=$chord_name&chord_number$x=$chord_number&position$x=$position&fingers$x=$fingers&";
$i++;
$x++;
}
echo "chord_amount=$chord_amount";
?>
Cheers !!