Php post to a mysql database
Posted: Thu Feb 02, 2006 1:20 am
Ok so first off i have regester_globals vales to on (i know its unsecure)
Here is the PHP code add.php all in CASE Sensitive:
Here is the code i used to create the table:
Not sure what is going on. I have also tried $movie_name=$_POST['movie_name'];
Here is the PHP code add.php all in CASE Sensitive:
Code: Select all
<?php
$user="root";
$pass="password";
$db="movielist";
$movie_name=$movie_name;
$web_address=$web_address;
$type_Action=$type_Action;
$type_Adventure=$type_Adventure;
$type_Animation=$type_Animation;
$type_Family=$type_Family;
$type_Comedy=$type_Comedy;
$type_Crime=$type_Crime;
$type_Documentary=$type_Documentary;
$type_Drama=$type_Drama;
$type_Fantasy=$type_Fantasy;
$type_Horror=$type_Horror;
$type_Independent=$type_Independent;
$type_Musical=$type_Musical;
$type_Mystery=$type_Mystery;
$type_Romance=$type_Romance;
$type_ScienceFiction=$type_ScienceFiction;
$type_Thriller=$type_Thriller;
$type_War=$type_War;
$type_Western=$type_Western;
$type_Holiday=$type_Holiday;
$rating=$rating;
$book=$book;
mysql_connect(localhost,$user,$pass);
mysql_select_db($db) or die( "Unable to select database, Please contact your administrator");
$query="INSERT INTO movie_list VALUES ('','$movie_name','$web_address','$type_Action',
'$type_Adventure','$type_Animation','$type_Family','$type_Comedy','$type_Crime',
'$type_Documentary','$type_Drama','$type_Fantasy','$type_Horror','$type_Independent',
'$type_Musical','$type_Mystery','$type_Romance','$type_ScienceFiction','$type_Thriller',
'$type_War','$type_Western','$type_Holiday','$rating','$book')";
echo "done";
?>Here is the code i used to create the table:
Code: Select all
<?php
$user="root";
$pass="password";
$db="movielist";
mysql_connect(localhost,$user,$pass);
mysql_select_db($db) or die( "Unable to select database Please contact the administrator.");
$query="CREATE TABLE movie_list (id int(7) NOT NULL auto_increment,movie_name varchar(100) NOT NULL,web_address varchar(150) NOT NULL,
type_Action int(1) NOT NULL,type_Adventure int(1) NOT NULL,type_Animation int(1) NOT NULL,type_Family int(1) NOT NULL,type_Comedy int(1) NOT NULL,
type_Crime int(1) NOT NULL,type_Documentary int(1) NOT NULL,type_Drama int(1) NOT NULL,type_Fantasy int(1) NOT NULL,type_Horror int(1) NOT NULL,
type_Independent int(1) NOT NULL,type_Musical int(1) NOT NULL,type_Mystery int(1) NOT NULL,type_Romance int(1) NOT NULL,
type_ScienceFiction int(1) NOT NULL,type_Thriller int(1) NOT NULL,type_War int(1) NOT NULL,type_Western int(1) NOT NULL,type_Holiday int(1) NOT NULL,
rating varchar(2) NOT NULL,book varchar(50) NOT NULL,Add_Date varchar(15) NOT NULL,PRIMARY KEY (id),UNIQUE id (id))";
mysql_query($query);
mysql_close();
print("<center><h1>Done Creating the Table</h1></center>");
?>