Hi,
I believe you can write it like this:
<?
$table_name = $Info[0];
if($table_name <= '9' ) {
$table_name = "Numbers";
}
mysql_connect($HOST, $USER, $PASSWORD)
or die("Could not connect to MySQL.");
mysql_select_db("practice")
or die("Could not access the database.");
$sql = "SELECT * from $table_name where artist = '$info'";
$result = mysql_query($sql)
or die($sql);
while($row = mysql_fetch_array($result)) {
print $row[0];
}
?>
The explanation is like this:
1. Get the text from your form input field called named 'Info'.
Grab the first character from that text and assign it to the var. $table_name.
Check to see if $table_name is numeric (You only need to check if it is <= 9 because it is, after all, only one char or digit).
If it is a numeric, then just reassign $table_name to the value 'Numbers' or whatever your numbers table is called. Otherwise, just leave $table_name alone.
Then, it's just a matter of writing the correct query to satisfy your needs.
Note: I am assuming that the columns for all your tables will be the same, i.e. the name and datatype of the column to search for the info is the same for all tables. In this case, I am guessing it is called 'artist'. Also, I am not doing any data validation here, so you may want to do that before sending the query to MySQL.
Hope this help!
Bart