Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 11th, 2006, 03:23 AM
Registered User
 
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem conecting to MySql - please help

Hi, there im still trying to teach myself AMP sites but got stuck at this point :
I've tried everything four times at least. please see error at end
<? php
// connect to MYSQL
$connect = mysql_connect("localhost", "cleared", "cleared") or
    die ("Hey loser, check your server connection.");

//create the main database if it doesn't already exist
$create = mysql_query("CREATE DATABASE IF NOT EXISTS moviesite")
    or die (mysql_error());

//make sure our recently created database is the activieone
mysql_select_db("moviesite");

//create "movie" table
$movie = "CREATE TABLE movie (
    movie_id int(11) NOT NULL auto-=increment,
    movie_name varchar(255) NOT NULL,
    movie_type tinyint(2) NOT NULL default 0,
    movie_year int(4) NOT NULL default 0,
    movie_leadactor int(11) NOT NULL default 0,
    movie_director int(11) NOT NULL default 0,
    PRIMARY KEY (movie_id),
    KEY movie_type (movie_type, movie_year)
");
$results = mysql_query ($movie)
    ordie (mysql_erro());

//create "movietype" table
$movietype = "CREATE TABLE movie type (
    movietype_id int(11) NOT NULL auto_increment,
    movietype_label varchar(100) NOT NULL,
    PRIMARY KEY (movietype_id)
)";

$results = mysql_qyery($movietypr)
    or die (mysql_erro());

//create "people" table
$people = "CREATE TABLE people (
    people_id int(11) auto_increment,
    people_fullname varchar(255) NOT NULL,
    people_isactor tinyint(1) NOT NULL default 0,
    people_isdirector tinyint(1) NOY NUll default 0,
    PRIMARY KEY (people_id)
)";
$results - mysql_query($people)
    or die(mysql_erro());
echo "movie datebase successfully created!";

?>

Parse error: parse error, unexpected T_VARIABLE in c:\easyserv\apache\test\createmovie.php on line 3
please help

 
Old October 12th, 2006, 12:37 AM
Registered User
 
Join Date: Oct 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
   Dear This is Rashmi.I m also working with Apache,mysql & php.
I ev to install mysql on linux.Actually i even don't know weather there is mysql already in our linux server.Although there is some files in lib dir.I tried a lot but did't get the solution.Will u pls tell me hoe to install mysql in Linux environment step by step
waitin for ur soon reply
Rashmi
[email protected]

 
Old October 29th, 2006, 09:26 PM
Registered User
 
Join Date: Oct 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to majika Send a message via Yahoo to majika
Default

Sup Daymeyen, the begining part looks ok

Quote:
quote:
<? php
// connect to MYSQL
$connect = mysql_connect("localhost", "cleared", "cleared") or
    die ("Hey loser, check your server connection.");
Have you tried to specify the correct port that the mysql is running on in the $connect var? (Default Mysql Port: 3306)

For Instance
Quote:
quote:
<? php
// connect to MYSQL
$connect = mysql_connect("localhost:3306", "cleared", "cleared") or
    die ("Hey loser, check your server connection.");
And it is as your error msg states, the error is found on line 3 ???
other than that syntax looks fine, I aint no php guru either so hope It helped










Similar Threads
Thread Thread Starter Forum Replies Last Post
MySql Database Problem surongama JSP Basics 0 October 16th, 2006 08:01 AM
mySQL problem Henry 8 PHP How-To 4 August 2nd, 2004 12:32 PM
problem with Mysql on SuSE 9.1 SuSE lover Linux 7 June 3rd, 2004 07:39 AM
MySQL queries problem hosefo81 PHP Databases 1 January 22nd, 2004 07:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.