You can get no. of indexes in a array useing count(ARRAY); it will return a numeric figure representing no. of indexes in given ARRAY.
vat you need to do is
1 - Create variable name dynamicaly. You can do this by using double dollar sign. LIKE $$strFieldName. This will make value of $strFieldName a variable.
Ex:
$strFieldName = "emp_name"
$$strFiledName = "George"
Here is how you will do all this
$contents = $querystring;
$fields = preg_split('/"/',$contents);
if(count($fields)){
$strQuery = "CREATE TABLE (";
for($nI=1; $nI <= count($fields); $nI++){
$strFieldName = "fldField" . $nI;
$$strFieldName = $fields[$nI-1];
$strQuery .= $$strFieldName . " varchar(255),";
} // end of for
$strQuery = substr($strQuery, 0, strlen($strQuery)-1);
$strQuery .= ");";
} // end of if