This function will return the number of records inside of a txtSQL table. It will look inside the $db if specified, and if not, txtSQL will look in the selected database.
Note- If $tablename does not already exists, txtSQL will issue an error
Note- If no $db is specified and no database is already selected, txtSQL will issue an error
