Please be aware that the mysql_* extension is now deprecated as of the current version of PHP and will very likely be removed from the next 5.x version and will likely not be in PHP 6.x (when it eventually is released). You should migrate over to either the mysqli_* extension or to PDO. PDO is a better choice as it doesn’t tie you down so much to a particular database server software.
Once you have migrated you should use Prepared Statements to prevent SQL Injection attacks. Have a read of this article from the PHP manual, it shows how to use prepared statements with PDO and also explains the principle.
As noted, move away from mysql.
Assuming you will have permission to create a DB table with php with your host, then it is possible.
As to the problem, you are not executing a query.
mysql_query("CREATE TABLE Dadoo(id INT NOT NULL AUTO INCREMENT,title VARCHAR(30),intro INT NOT NULL,details VARCHAR(30) NOT NULL,PRIMARY KEY(id)) ENGINE=MyISAM") or die(mysql_error());
OR
mysql_query("CREATE table IF NOT EXISTS Dadoo(id INT NOT NULL AUTO INCREMENT,title VARCHAR(30),intro INT NOT NULL,details VARCHAR(30) NOT NULL,PRIMARY KEY(id)) ENGINE=MyISAM") or die(mysql_error());
2 question :
1- why it cant’t make auto table in db?
2- when make Dadoo table in db give this error:::
Column count doesn’t match value count at row 1
Thank’s
when create query
mysql_query("CREATE table IF NOT EXISTS Dadoo(id INT NOT NULL AUTO INCREMENT,title VARCHAR(30),intro INT NOT NULL,details VARCHAR(30) NOT NULL,PRIMARY KEY(id)) ENGINE=MyISAM") or die(mysql_error());
give this error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘AUTO INCREMENT,title VARCHAR(30),intro INT NOT NULL,details VARCHAR(30) NOT NULL’ at line 1
You need the underscore between AUTO INCREMENT. Also adding back tics for table name and fields might help.
mysql_query("CREATE table IF NOT EXISTS `Dadoo` (`id` INT NOT NULL AUTO_INCREMENT, `title` VARCHAR(30), `intro` INT NOT NULL, `details` VARCHAR(30) NOT NULL, PRIMARY KEY(`id`)) ENGINE=MyISAM") or die(mysql_error());
$articles = array();
mysql_select_db ( "price", $con );
"CREATE TABLE Dadoo(id INT NOT NULL AUTO INCREMENT,title VARCHAR(30),intro INT NOT NULL,details VARCHAR(30) NOT NULL,PRIMARY KEY(id)) ENGINE=MyISAM" or die(mysql_error());
$debugquery = mysql_query("INSERT INTO Dadoo (title, intro, details) VALUES ('$articles')");
if (!$debugquery)
{
die(mysql_error());
}