Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i've searched over the internet an i found what i wrote there below but i'm getting a syntax error..please for help..
for example
<?php

$table_name = $_POST["name"];

try {
$sql = "CREATE TABLE " .$table_name. " (

id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,

joketext TEXT,

jokedate DATE NOT NULL

)";
?>

please i will like to know the correct syntax for using $table_name as the name of my table..given that $table_stores a post value

What I have tried:

<?php

$table_name = $_POST["name"];

try {
$sql = "CREATE TABLE " .$table_name. " (

id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,

joketext TEXT,

jokedate DATE NOT NULL

)";
?>
Posted
Updated 27-Dec-17 2:45am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900