Hi,

I want to create a table in Mysql but i receive an error.
Warning: mysqli_query() expects parameter 1 to be mysqli, null given in C:\wamp\www\CreateTable\create.php on line 11
Table veriler_2 couldn't been created! :

i give you the whole lines to check it for me. I can not find anything.
$sql = "CREATE TABLE veriler_2
(id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, ad VARCHAR (10), soyad VARCHAR (10))";
$res = mysqli_query($mysql, $sql);

Thanks

resource mysql_query ( string $query [, resource $link_identifier ] )

$res = mysqli_query($mysql, $sql);
$res = mysql_query( $sql, $mysql );
Where $sql - query to mysql server
And $mysql - resource givven by mysql_connect().

done, i have forgotten to put "i" after "mysql"
$res = mysqli_query($mysqli, $sql);

Oh, sure my mistake. Did you get a link identifier by mysqli_connect?

mysqli mysqli_connect ([ string $host [, string $username [, string $passwd [, string $dbname [, int $port [, string $socket ]]]]]] )

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.