Hei!
This is what my error-message is "4 5.1.44Zm7f}e_-ÿ÷_w[Aq7ZC}o6]ÿ„Got packets out of order".
My localhost port-number is :8888 when running scripts, but as far as I can see it is :8889 when it comes to MySql. The connection goes well, but the creation of the db is not so well.
How (in what file) do I change to :8888 for MySql if that is the solution?
This is what I have got:
Code:
//Koble til databasen
$connect = mysql_connect("localhost", "root", "root") or
die("Sjekk databaseoppkoblingen!");
//lager hoveddatabasen
$create = mysql_query("CREATE DATABASE IF NOT EXISTS moviesite") or
die(mysql_error());
But when I did some change to the hole script and reduced the number of tables to be created (and // eliminate one line!), left out the creation of a new db, then it went ok... Please take a look and comment;
Code:
//Tilkobling og valg av database
$connection = mysql_connect("localhost", "root", "root");
mysql_select_db("some_db", $connection);
//Sette en sql-spørring mot db
//Lage movie-tabellen
$movie = "CREATE TABLE movie (";
$movie .= " movie_id int ( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,";
$movie .= " movie_name VARCHAR ( 255 ) NOT NULL,";
$movie .= " movie_type TINYINT ( 2 ) NOT NULL DEFAULT 0,";
$movie .= " movie_year INT ( 4 ) NOT NULL DEFAULT 0,";
$movie .= " movie_leadactor INT ( 11 ) NOT NULL DEFAULT 0,";
$movie .= " movie_director INT ( 11 ) NOT NULL DEFAULT 0,";
//$movie .= " KEY movie_type (movie_type, movie year);
$movie .= ")";
mysql_query($movie, $connection);
echo $movie;
But I am not quite shure about what changes which are in place in order to make it work?! Has this to do with the version-no of my PHP? And also: what is this line ment to do?
Code:
//$movie .= " KEY movie_type (movie_type, movie year);
Establish a relation between to tables? How can I solve this now if that is the case?
Hmmm... it seems that some of the solution (with my MySql ver 5.1.44) are:
Code:
$create = mysql_query("CREATE DATABASE moviesite") or
die(mysql_error());
//The "IF NOT EXISTS" is left out and the line which was commented out previously was missing the ,"; at the end! Puuuhh!
$movie .= " KEY movie_type (movie_type, movie year),";
Regards,
grstad
