paulman888888 Posted October 26, 2008 Share Posted October 26, 2008 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 'id DESC LIMIT 0,10' at line 3 There is no mysql code on line 3. full code is error http://rockworld.atzend.com/songs/test.phps Why does is say theres an error on line 3 when theres no Mysql script there? I thankyou so much for the help Paul Quote Link to comment https://forums.phpfreaks.com/topic/130152-anoying-sql-syntax-error/ Share on other sites More sharing options...
MadTechie Posted October 26, 2008 Share Posted October 26, 2008 $query = "SELECT * FROM rock_songs ORDERby id DESC LIMIT $start,$limit"; should be $query = "SELECT * FROM rock_songs ORDER BY id DESC LIMIT $start,$limit"; Quote Link to comment https://forums.phpfreaks.com/topic/130152-anoying-sql-syntax-error/#findComment-674914 Share on other sites More sharing options...
mtylerb Posted October 26, 2008 Share Posted October 26, 2008 Also, further down, shouldn't: function edit_file(){ if(isset($_POST['edit_id'])): $edit_id = $_POST['edit_id']; $maker = $_POST['maker']; $song_name = $_POST['song_name']; $dataquery="UPDATE rock_songs SETsong_name = '$song_name', maker = '$maker' WHEREid = '$edit_id' be: $dataquery="UPDATE rock_songs SET song_name = '$song_name', maker = '$maker' WHERE id = '$edit_id' And near the end: function delete_file(){ if($_GET['op'] == "confirm"): $delete_id = $_GET['id']; $filedel = $_GET['filename']; $dataquery="DELETEFROM rock_songs WHERE id = '$delete_id'"; be: $dataquery="DELETE FROM rock_songs WHERE id = '$delete_id'"; Quote Link to comment https://forums.phpfreaks.com/topic/130152-anoying-sql-syntax-error/#findComment-674915 Share on other sites More sharing options...
MadTechie Posted October 26, 2008 Share Posted October 26, 2008 well spotted mtylerb, i only looked at the error inquestion lol, but still valid points thats probably all the SQL bugs (unless illogical ones remain) Quote Link to comment https://forums.phpfreaks.com/topic/130152-anoying-sql-syntax-error/#findComment-674918 Share on other sites More sharing options...
Barand Posted October 26, 2008 Share Posted October 26, 2008 And in answer to this question Why does is say theres an error on line 3 when theres no Mysql script there? the 3 refers to the line in the query statement itself $query = "SELECT * FROM rock_songs ORDERby id DESC <--------- line 3 LIMIT $start,$limit"; Quote Link to comment https://forums.phpfreaks.com/topic/130152-anoying-sql-syntax-error/#findComment-674932 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.