title: Is it MySQL or my php?
body: <p>I'm working on a REST API system to allow people to download a git project and easily set up an API for their mobile app or web service.  I have a setup page and I'm having a problem with creating table's.  </p>
  
  <p>Here's a link to my github project, it is <strong>nowhere</strong> near complete but you can watch it's progress with updates nearly everyday: <a href="https://github.com/evanstoddard/REST-Easy" rel="nofollow noreferrer">https://github.com/evanstoddard/REST-Easy</a></p>
  
  <p>I have a sql statement that works when I paste it into phpMyAdmin but it gives me an error in php.  I used mysqli_error and I just get that there is an error with my statement.</p>
  
  <p>Here's my sql statement:</p>
  
  <pre><code>CREATE TABLE `applications` (
    `appID` int(11) NOT NULL AUTO_INCREMENT,
    `appName` varchar(10000) NOT NULL,
    `appDB` varchar(10000) NOT NULL,
    `appPrefix` varchar(10000) NOT NULL,
    PRIMARY KEY (`appID`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
  
  CREATE TABLE `login` (
    `userID` int(11) NOT NULL AUTO_INCREMENT,
    `username` varchar(1000) NOT NULL,
    `emailAddress` varchar(1000) NOT NULL,
    `password` varchar(10000) NOT NULL,
    `hash` varchar(10000) NOT NULL,
    `verified` tinyint(1) NOT NULL,
    PRIMARY KEY (`userID`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
  
  CREATE TABLE `saltTable` (
    `userID` int(11) NOT NULL AUTO_INCREMENT,
    `salt` varchar(10000) NOT NULL,
    PRIMARY KEY (`userID`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1
  </code></pre>
  
  <p>Here's my php function:</p>
  
  <pre><code>function createInitialTables(){
  
      $serverURL = $_SESSION['server'];
      $username = $_SESSION['username'];
      $password = $_SESSION['password'];
      $database = $_SESSION['database'];
  
      $con = mysqli_connect($serverURL, $username, $password, $database);
  
      $sql = 'CREATE TABLE `applications` (
    `appID` int(11) NOT NULL AUTO_INCREMENT,
    `appName` varchar(10000) NOT NULL,
    `appDB` varchar(10000) NOT NULL,
    `appPrefix` varchar(10000) NOT NULL,
    PRIMARY KEY (`appID`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
  
  CREATE TABLE `login` (
    `userID` int(11) NOT NULL AUTO_INCREMENT,
    `username` varchar(1000) NOT NULL,
    `emailAddress` varchar(1000) NOT NULL,
    `password` varchar(10000) NOT NULL,
    `hash` varchar(10000) NOT NULL,
    `verified` tinyint(1) NOT NULL,
    PRIMARY KEY (`userID`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
  
  CREATE TABLE `saltTable` (
    `userID` int(11) NOT NULL AUTO_INCREMENT,
    `salt` varchar(10000) NOT NULL,
    PRIMARY KEY (`userID`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
  ';
  
      $result = mysqli_query($con, $sql);
      $error = mysqli_error($con);
  
      print($error);
  
  }
  </code></pre>
  
  <p>Here's the mysqli_error():</p>
  
  <pre><code>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 `login` (
    `userID` int(11) NOT NULL AUTO_INCREMENT,
    `username` ' at line 9CREATE TABLE `applications` (
    `appID` int(11) NOT NULL AUTO_INCREMENT,
    `appName` varchar(10000) NOT NULL,
    `appDB` varchar(10000) NOT NULL,
    `appPrefix` varchar(10000) NOT NULL,
    PRIMARY KEY (`appID`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
  </code></pre>
  
  <p>I believe it is a problem with my php because my statement works in phpMyAdmin.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>The solution has been found.  As  <a href="https://stackoverflow.com/users/1326403/ben-emmett">Ben Emmett</a> pointed out, I am trying to execute 3 sql queries with <code>mysqli_query()</code> when I should be using <code>mysqli_multi_query()</code>.</p>