Granting access makes sense. Now what is the difference between the user information I put into the mysql_connect function and "PHP user"? If there is a difference , how would I grant the access via a query and how would it affect the new users who will use the application when it is given to my client? Also, a preview reply mentioned mysql_error(). How would I use function to verify that the table was created? Do I simply write If (mysql_error() != "") Return false -----Original Message----- From: Ignatius Reilly [mailto:ignatius.reilly@free.fr] Sent: Friday, December 06, 2002 3:34 PM To: php-db@lists.php.net Subject: Re: CREATE TABLE QUERY PHP/MySQL Very likely you have to GRANT the CREATE permission to your PHP user account. Also investigate the CREATE TEMPORARY TABLE grant status available since version 4+. Very convenient. Ignatius ____________________________________________ ----- Original Message ----- From: "Jonathan" <dbphp@ftbwebsolutions.com> To: <php-db@lists.php.net> Sent: Friday, December 06, 2002 10:00 PM Subject: CREATE TABLE QUERY PHP/MySQL > This is the first time I am trying to create a table in MySQL based on > user input. > > Here is the scenario, > > The user will enter in the name of a stage, e.g. Harley Davidson. > I then look for the first space (to indicate the first word), make it > into lower case and then do the following: > > $new_stage_name = "stage_".$var; > > This will give $new_stage_name the value of "stage_harley". > > That works fine. > > Now I want to run the following query: > > $SQL = "CREATE TABLE ".$new_stage_name." (set values and their > properties)"; > > If I run this query using PHPMyAdmin, minus the var of course, the table > is created. > > When I run it in my code, nothing happens. I do a die($SQL) to see the > final outcome of the query and it's correct and is what I am using to > run the query in PHPMyAdmin. > > This is what my code is doing: > > I have class RecordSet which makes the db connection and its constructor > takes the $SQL as an arg. > > So, $SQL = "what is listed above"; > $objRecordSet = new RecordSet($SQL); > //I used this all the time with all kinds of other Select, Insert, > Update, and Delete queries and it works perfect. > > For one, I don't know how to test whether the table has been created or > not. I know I could probably do some sort of mysql_list_tables and look > for it or whatever but I was looking for something similar to > > If (mysql_affected_rows() == -1) > Because that is very easy. > > And ideas as to why the table is not being created. > > =================== > Jonathan Villa > Application Developer > IS Design & Development > www.isdesigndev.com > 414.429.0327 > =================== > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php