hi, i have to pieces of php code that i need to place into one but am unsure how to do it, firstly i have my peice of php to upload a few statistics:
<?php
include 'mysqlconnect.php';
$db = mysql_select_db("upload_frenzy", $con);
if (!$db)
{
die('Can not Connect to Database: ' . mysql_error());
}
$file_name =$_POST['file_name'];
$file =$_POST['file'];
$file_description =$_POST['file_description'];
$user_ip =$_SERVER['REMOTE_ADDR'];
$sql="INSERT INTO uploads (file_name, file, file_description, user_ip)
VALUES
('$file_name','$file','$file_description','$user_ip')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
header('location:home');
mysql_close($con)
?>
And secondly i have a piece of code straight from w3schools which i will later modify to suit my needs:
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
?>
Could someone please help me in putting these two pieces of code together so they work with each other?