Please could you guys help!!!!!
Posted: Sat Sep 22, 2007 7:31 am
feyd | Please use
any feedback would be great
ps i m a total newbie at php code sorry if m asking a stupid question
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi i am trying to create a php script which when it runs will create my SQL database and tables or is their always an easier way to do this.Code: Select all
<?php
$connect = mysql_connect("localhost", "root@localhost", "mysqlpass") or
die ("Cannot conect to database");
mysql_create_db("barker")
or die(mysql_error());
mysql_select_db ("barker");
$movie = "CREATE TABLE movie (
movie_id int(11) NOT NULL auto_increment,
movie_name varchar(255) NOT NULL,
movie_review varchar(255) NOT NULL,
movie_type tinyint(2) NOT NULL default 0,
movie_year int(4) NOT NULL default 0,
movie_age 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)
) TYPE=MyISAM AUTO_INCREMENT=4 ";
$results = mysql_query($movie)
or die (mysql_error());
$movietype = "CREATE TABLE movietype (
movietype_id int(11) NOT NULL auto_increment,
movietype_label varchar(100) NOT NULL,
PRIMARY KEY (movietype_id)
) TYPE=MyISAM AUTO_INCREMENT=9" ;
$results = mysql_query($movietype)
or die (mysql_error());
$people = "CREATE TABLE people (
people_id int(11) NOT NULL auto_increment,
people_fullname varchar(255) NOT NULL,
people_isactor tingint(1) NOT NULL default 0,
people_isdirector tinyint(1) NOT NULL default 0,
PRIMARY KEY (people_id)
) TYPE=MyISAM AUTO_INCREMENT=7";
$results = mysql_query($people)
or die (mysql_error());
echo "Movie Database was created";
?>ps i m a total newbie at php code sorry if m asking a stupid question
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]2.[/b] Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.[/quote]