Jump to content

[SOLVED] Mysql Problem


xshanelarsonx

Recommended Posts

This keep's giving me this error.

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's','aa's.mp3', '0')' at line 1"

 

$songname = aa's

 

mysql_connect("localhost","root","hs") or die ("Unable to connect to MySQL server."); 
mysql_select_db("Music") or die ("Unable to select requested database."); 
$music = array(".mp3");
$fname = $_FILES['file']['name'];
$ext = strrchr($fname,'.');
if (!in_array(strtolower($ext),$music)) {
echo "~~Wrong file extension -- Music*.mp3* only~~<br /><a href='Music.php'>Back</a>";
}else{
$fname = $songname.".mp3";
$fname = str_replace(' ', '', $fname);
$fname = stripslashes($fname);
$songname = stripslashes($songname);
move_uploaded_file($_FILES["file"]["tmp_name"],"Files/Music/" ."$fname" );
$MuscUpload = "INSERT INTO songs(SongName , File, Seconds) VALUES('$songname','$fname', '0')";
mysql_query($MuscUpload) or die("MySQL ERROR: ".mysql_error());

Link to comment
https://forums.phpfreaks.com/topic/38259-solved-mysql-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.