Benim MySQL bir sözdizimi hatası gibi görünüyor

0 Cevap php

MySQL şu hatayı koyuyor:

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 'CREATE TABLE IF NOT EXISTS `badips` ( `id` int(10) NOT NULL auto_increment, ' at line 2

Ben aşağıdaki PHP çalıştırdığınızda:

if (file_exists("../login/includes/config.php")) {

    $db_schema = array();

$db_schema[] = "DROP TABLE IF EXISTS `badips`;
CREATE TABLE IF NOT EXISTS `badips` (
  `id` int(10) NOT NULL auto_increment,
  `host` varchar(50) NOT NULL,
  `ip` varchar(20) NOT NULL,
  `enteredhost` varchar(50) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=26 ;";

require_once('../login/includes/config.php');
require_once('open-db.php');

      echo "<h3>Creating tables...</h3>";
      foreach($db_schema as $sql) {
       mysql_query($sql) or die(mysql_error());
      }
      echo "<h3>Done!</h3>";
  }

Ben PHPMyAdmin aynı SQL çalıştırmak Ancak, herhangi bir kusurları olmadan çalışır. Ben sorunun ne olduğunu çözemiyorum. Herkes biliyor?

0 Cevap