Php creating a table in mysql using a variable as table name.?
-
Hi, Im trying to create a table in mysql using variable $signupemail as table name. Here is my code mysql_select_db("profiles",$connect); mysql_query("CREATE TABLE ".$signupemail." (FirstName VARCHAR(30), LastName VARCHAR(30), DateofBirth DATE)",$connect); I have already tried single quotes, double quotes, period strings and curly brackets. Anyone knows what is wrong here? Thanks! :)
-
Answer:
its been a while since i worked with php, but it looks good to me. try setting the query as a variable $test="CREATE TABLE ".$signupemail." (FirstName VARCHAR(30), LastName VARCHAR(30), DateofBirth DATE)"; then print out test to make sure signupemail actually holds the value you expect it to EDIT: do mysql_query(test) or die("mysql error: " . mysql_error()); post the error result
Yang at Yahoo! Answers Visit the source
Related Q & A:
- How does MySQL reindex a table?Best solution by Stack Overflow
- How to pass a variable from php to a modal?Best solution by Stack Overflow
- How do I upload a picture instead of using a generic avatar?Best solution by answers.yahoo.com
- How to start creating a php script, that will be installed on many servers?Best solution by Stack Overflow
- Where can I find good a tutorial for creating a simple flash movie using Adobe Flash CS4?Best solution by Graphic Design
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.