MYSQL Query error creating table
<p>I'm running on Mysql Server 5.7.13 and every time I try to create a table it throws this error:</p>

<blockquote>
  <p>Error creating table: 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 content ( id INT NOT NULL AUTO_INCREMENT, page_id longtext, t' at line 5 </p>
</blockquote>

<p>Here is my query code:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
// Connect to MySQL
$link = mysql_connect('localhost', 'root', '****');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
 $name = $_POST['name'];

// Make my_db the current database
$db_selected = mysql_select_db($name, $link);

if (!$db_selected) {
  // If we couldn't, then it either doesn't exist, or we can't see it.
$sql = "
  CREATE DATABASE IF NOT EXISTS $name;
  USE $name;
CREATE TABLE content
(
  id INT NOT NULL AUTO_INCREMENT,
  page_id longtext,
  title longtext,
  about longtext,
  content longtext,
  PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE details
(
  id INT NOT NULL AUTO_INCREMENT,
  website_name longtext,
   PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE media
(
  id INT NOT NULL AUTO_INCREMENT,
  page_id longtext,
  post_id longtext,
  time longtext,
  date longtext,
  format longtext,
  PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE pages
(
  id INT NOT NULL AUTO_INCREMENT,
  title longtext,
  PRIMARY KEY (id)
) ENGINE=InnoDB;";
var_dump($sql);
  if (mysql_query($sql, $link)) {
      echo "Database $name created successfully\n&lt;br/&gt;";
  } else {
      echo 'Error creating database: ' . mysql_error() . "\n&lt;br/&gt;";
  }

}

mysql_close($link);
?&gt;</code></pre>
</div>
</div>
</p>

<p>Var dumb Results of Sql</p>

<p>/storage/www/cms/dbcreate.php:51:string </p>

<pre><code>'USE socialnetwk;

CREATE TABLE content
(
  id INT NOT NULL AUTO_INCREMENT,
  page_id longtext,
  title longtext,
  about longtext,
  content longtext,
  PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE details
(
  id INT NOT NULL AUTO_INCREMENT,
  website_name longtext,
   PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE media
(
  id INT NOT NULL AUTO_INCREMENT,
  page_id longtext,
  post_id longtext,
  time longtext,
  date longtext,
  format longtext,
  PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE pages
('... (length=600)
Database socialnetwk created successfully 
Error creating database: 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 content ( id INT NOT NULL AUTO_INCREMENT, page_id longtext, t' at line 5 
</code></pre>