People, I already give up.

Show an example of creating a table in mysql (); Rummaged through the forums and created

$Link = @mysqli_connect($db_host, $db_username, $db_password); mysqli_select_db($Link, $db_databases) or die(mysql_error()); mysql_query("CREATE TABLE `testdb`.`tests` (`id` INT NOT NULL ,`test` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , PRIMARY KEY ( `id` )); ") Or die(mysql_error()); 

Got an error

CREATE command denied to user ''@'localhost' for table 'tests'.

    3 answers 3

    And the user, under which you connect to the database, have the privilege to create to create databases?

    • $ db_host = 'test1.ru'; $ db_username = 'root'; $ db_password = ''; downloaded from denwer.ru - zloctb
    • one
      Is the string downloaded from the site or is Denver installed ?, does the testdb database itself exist? - Ale_x

    Perhaps the user under which you are trying to create a database does not have privileges for such actions.

    • probably yes! And the request is made correctly? - zloctb

    Here the mistake was to use a different treatment of mysqli_ and mysql_. Apparently it was necessary to use everywhere 1 syntax.

     $connection=mysql_connect($db_host,$db_login,$db_password); if(!$connection){ echo 'connection is wrong'; } //mysql_query("CREATE DATABASE `wwot`") or die(mysql_error()); mysql_select_db('wwot') or die(mysql_error()); mysql_query("CREATE TABLE `tests` (`id` INT NOT NULL ,`test` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , PRIMARY KEY ( `id` )); ") Or die(mysql_error()); 

    Then the question was born - what is better mysqli_ or mysql? thanks to all

    • one
      Better PDO) - Ale_x