Creating SQL queries for a MySQL database
Assuming you're protecting yourself from SQL Injection and the like, there are just a couple things that stand out to me:


It doesn't seem clear to me why the closing parenthesis for your primary key constraint is in the create_ct_query2() function rather than in the primary_key_constraint() function.
I believe the code would be far easier to read, test, and extend if it were built using objects rather than global functions.
Since you are new to PHP, I think it is worth mentioning that single quotes and double quotes are treated differently.  Knowing this, as a personal preference, I tend to use single quotes unless I intentionally need / want to use the added functionality of double quotes.
While related to refactoring, I believe my other suggestions start to delve more in to the readability of things like create_ct_query().  This starts to feel a bit nit-picky, and almost a matter of style.  For example, with create_ct_query(), it took me a minute to realize what "ct" meant.  Only after looking inside the function and seeing the string being created did I realize what it did.  I feel that something like "get_create_table_query()" or similar would be a bit more intuitive.


Regarding documentation, I have found Eclipse and other tools to utilize the following style of doc-blocks.  The @return is especially useful for code-completion of methods available on the returning object in my IDE.  Documentation tools tend to have built-in support for other tags like @author as well.

/**
 * Description of someMethod()
 *
 * @param int $someInt
 * @param ObjectName $someObj
 * @return AnotherObj
 */
public function someMethod($someInt, ObjectName $someObj)
{
    // ... 

    return new AnotherObj();
}