well, there are many problems with your code. first of all, where are you getting those field_* variables from?
A form? anyway, seeing as you're evaluating them BEFORE you query, they'll be empty, thereby destroying your query, giving you that error. try this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Create a Database Table: Step 3</TITLE></HEAD>
<BODY>
<h1>Adding table <?php echo "$table_name"; ?></h1>
<?
//connect
$connection = mysql_connect("localhost","nack7829","password")
or die("Couldn't connect to server:" . mysql_error()); // VERY useful!
//select
$db = mysql_select_db("DB_nack7829", $connection)
or die("Couldn't select database:" . mysql_error());
//set the query:
$sql = "CREATE TABLE $table_name (";
for ($i = 0; $i < count($field_name); $i++) {
$sql .= "$field_name[$i] $field_type[$i]";
if ($field_length[$i] != "") {
$sql .= " ($field_length[$i]),";
} else { // closes if
$sql .= ",";
} // closes else
} // closes for
$sql = substr($sql, 0, -1);
$sql .= ")";
// query
$sql_result = mysql_query($sql,$connection)
or die("Couldn't execute query.");
/*pointless, as the die will stop
executing the script before you
reach this point*/
if (!$sql_result) {
echo "<P>Couldn't create table!";
} else { // closes if
echo "<P>$table_name has been created!";
} // closes else
?>
</BODY>
</HTML>
if the info is being recieved from a form, use $POST['field'] or $GET['field'] for the variables. where are you getting them from?