I am trying to insert data in to MySQL Database, but have been stuck on Data insertion.
I am using Version 3.0.0
of WampServer and PHP 5.6.16
, phpMyAdmin 4.5.2
.
Everything else are ok, I can UPDATE, DELETE
...Except INSERT INTO
.
Code
<?php
$con=@mysql_connect('localhost','root','');
mysql_query('SET NAMES utf8;');
mysql_select_db('mydb',$con);
//////////////////////////////////
if(isset($_POST['post_files'])) {
$files = $_POST['files'];
$title = $_POST['title'];
//////////////////////////////////
$query = "INSERT INTO files (`file`, `title`) VALUES ('$files', '$title')";
if(mysql_query($query))
{
echo'OK, Data Inserted.';
}
else
{
echo 'Sorry! Operation failed.';
}
}
mysql_close();
?>
These Bunch of codes were working fine in previous PHP versions.