Alright so me and my friend are hosting our own website. We have everything we need installed on it.
Just last week we got a video uploading script to work, thanks to some people on here. What the script does is uploads the video to the database and writes info for the video (video title, description, etc.) to a database. Because of all the tests we did on the MySQL database, we decided to delete and recreate the database itself, so that I didn't have to manually delete every row in the table.
Fast forward to today, the first time I'm using the script since the database was deleted. I'm uploading a video, and I get this error:
Can't create table '.\porn\videos.frm' (errno: 121)
This is really weird because since the database was deleted and recreated, neither me or my friend had touched the PHP script. It was working perfectly before the database was recreated, so I'm really confused.
Here's the code I'm using (and yes, the password is blank on purpose):
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$fTitle = mysql_escape_string($_POST['fTitle']);
$fDesc = mysql_escape_string($_POST['fDesc']);
$fName = mysql_escape_string($_POST['fName']);
$gName = mysql_escape_string($_POST['gName']);
// Create table in database
mysql_select_db("stuff", $con);
$sql = 'CREATE TABLE IF NOT EXISTS videos (
fTitle varchar(30),
fDesc text,
fName text,
gName text
)';
$result = mysql_query($sql);
if(!$result)
die( mysql_error() ); // No reason to move on if we've got no table
echo "Database Table Created...<br>";
//Inserting Data
mysql_query("INSERT INTO videos (fTitle, fDesc, fName, gName)
VALUES ('$fTitle', '$fDesc', '$fName', '$gName')");
echo "Data Inserted...<br><br>";
//Displaying Data
$result = mysql_query("SELECT * FROM videos");
if(!$result)
echo mysql_error();
echo "<table border='1'>
<tr>
<th>Video Title</th>
<th>Video Description</th>
<th>File Name</th>
<th>Star's Name</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['fTitle'] . "</td>";
echo "<td>" . $row['fDesc'] . "</td>";
echo "<td>" . $row['fName'] . "</td>";
echo "<td>" . $row['gName'] . "</td>";
echo "</tr>";
}
echo "</table>";
echo "<br><br><br>";
$file_name = $_FILES['ufile']['name'];
$path= "uploads/" . $fName;
if(is_uploaded_file($_FILES['ufile']['tmp_name']))
{
if(move_uploaded_file($_FILES['ufile']['tmp_name'], $path))
{
echo "Successful!<BR/>";
echo "File Name:" . $fName . "<BR/>";
echo "File Size: ".$_FILES['ufile']['size']." bytes <BR/>";
echo "File Type:".$_FILES['ufile']['type']."<BR/>";
}
else
{
echo "Error";
}
}
mysql_close();
Anyone have any idea what's going on here. I'm completely lost.