I have two php files one check to see if a database and table is present if it's not it create both (check.php). The other collects info from a form and then inputs that data to the database and copy the mp3 file to a location on my computer(masterupload.php).
So far the only to things I know thats working is that it will create a database or table if one is not present {check.php files does that} and that it will copy the file to a location on the server {masterupload.php does that} But the problem I am having is that it won't copy info from the form to the table here are the two php files in question:
Why am I unable to write info from the form to the mysql table???
this is the masterupload.php whick includes an call to the check.php file via include()
<?php
if ($_POST['action']) {
/$dir = "/home/nucity44/public_html/mp3_files/";/
$dir = "C:\Program Files\Apache Group\Apache2\htdocs\mp3_files\";
$uploadfile = $dir . $_FILES['mp3_file']['name'];
move_uploaded_file($_FILES['mp3_file']['tmp_name'], $uploadfile);
include 'check.php';
$sql = "INSERT INTO $table (Song_Name, Artist, Release_Date, Additional_Notes, Path )
VALUES ($POST[name], $POST[artist], $POST[date], $POST[notes],$uploadfile)";
mysql_query($sql);
}
?>
check.php
<?php
$host= "localhost";
$dbuser= "usernamer";
$dbpass= "password";
$database= "mp3_db";
$table= "mp3_files";
$link= @mysql_connect($host, $dbuser, $dbpass)
or die ('I cannot connect to the database because: ' . mysql_error());
if (! @mysql_select_db($database,$link)){
mysql_query("CREATE DATABASE $database");
}
else
{
if(! @("SELECT * FROM $table LIMIT 0,1")){
$sql="CREATE TABLE $table (
id INT NOT NULL auto_increment ,
Song_Name VARCHAR(255) NOT NULL ,
Artist VARCHAR(255) NOT NULL ,
Release_Date DATE NOT NULL ,
Additional_Notes VARCHAR(255) NOT NULL ,
Path VARCHAR(255) NOT NULL ,
PRIMARY KEY (id)
)" ;
mysql_query($sql);
}
}
?>