user3549226
user3549226

Reputation: 1

Creating database tables within Dreamweaver not working

I've used this script to link to my database account (1&1), using Dreamweaver, which proves to be a successful connection yet cannot seem to create tables for my database when this is linked, was just wondering if anyone has any idea in how to go about the right way with this as I can't seem to get it working.

My database connection which works.

<?php

$hostname="db************";
$database="db********";
$username="db********";
$password="*********";

$link = mysql_connect($hostname, $username, $password);
if (!$link) {
die('Connection failed: ' . mysql_error());
}
else{
      echo "Connection to MySQL server " .$hostname . " successful!
" . PHP_EOL;
}

$db_selected = mysql_select_db($database, $link);
if (!$db_selected) {
     die ('Can\'t select database: ' . mysql_error());
}
else {
     echo 'Database ' . $database . ' successfully selected!';
}

mysql_close($link);

?>

This is the tables script i'm using which doesn't work .

<?php
include_once("php_includes/db_conx.php");

// CREATE TABLE USER

$sql= "CREATE TABLE USER (
id_user_pk INT NOT NULL AUTO_INCREMENT,
nick VARCHAR(40),
email VARCHAR(40),
password VARCHAR(20),
user_reg_date DATE,
PRIMARY KEY (id_user_pk)
) TYPE=INNODB";
mysql_query($sql);

?> 

Upvotes: 0

Views: 321

Answers (1)

Ionel Scutelnicu
Ionel Scutelnicu

Reputation: 11

You must use "ENGINE=INNODB" instead of "TYPE=INNODB";

CREATE TABLE `user` (
  `id_user_pk` int(11) NOT NULL AUTO_INCREMENT,
  `nick` varchar(40) DEFAULT NULL,
  `email` varchar(40) DEFAULT NULL,
  `password` varchar(20) DEFAULT NULL,
  `user_reg_date` date DEFAULT NULL,
  PRIMARY KEY (`id_user_pk`)
) ENGINE=INNODB;

Upvotes: 1

Related Questions