Answer the question
In order to leave comments, you need to log in
What's wrong with the code? MySQL query not correct?
<?php
const N = "\n";
if(!$mysqli = @mysqli_connect('127.0.0.1', 'root', 'password', 'site'))
exit('Fatal error: Couldn\'t connect to MySQL DB.');
if(mysqli_num_rows(mysqli_query($mysqli, 'SHOW TABLES LIKE `users`')) == 0) {
mysqli_query($mysqli,
'CREATE TABLE `users` ('.N.
' `id` int(11) unsigned NOT NULL auto_increment,'.N.
' `email` varchar(30) NOT NULL,'.N.
' `password` varchar(32) NOT NULL,'.N.
' PRIMARY KEY (`id`)'.N.
') ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'
);
}
mysqli_query()
returns false, although the request is valid. What's wrong?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question