Is there anything wrong with this query?
I can't seems to insert the data into my database.
mysql_query("INSERT INTO videos VALUES('', '$name', 'videos/$random_name.$type')");
Not sure if this helps but this is the one that connects to my database.
$db = mysqli_connect('localhost', 'root', '');
mysqli_select_db($db, 'video_system');
you are connect with the mysqli driver but make your query with mysql_
first of all use mysqli or mysql... then don't forget to escape your strings!
escape with
mysqli_real_escape_string($your_mysqli_connection, $string);
and check your connection first like
$connection = mysqli_connect(....);
if(false === $connection ){
//connection failed.. do something!
exit;
}
also your selection
$selection = mysqli_select_db($connection, 'your_db_name');
if(false === $selection ){
//selection failed.. do something!
exit;
}
run your query like this
mysql_query('mysqlscripts are cool', $connection);
It is because you're mixing mysql_
and mysqli_
Be sure to use one and stick to one (however mysqli_*
is the preferred method).
Read up on this link to learn how to use mysqli_*
properly.