lewis987 Posted May 19, 2007 Share Posted May 19, 2007 heres the code, i will post anything else you need to know elseif($_REQUEST['action']=="delpic") { mysql_select_db("login", $con); mysql_query("DELETE FROM '$user' WHERE Name = ('$name')"); $FTP_con = ftp_connect("xxx.xxx.xxx.xxx",21); ftp_login($FTP_con,"user","pass"); ftp_delete($FTP_con, $pathpic); ftp_close($FTP_con); } i want to delete a row from mysql when the delete link is pressed, but for some reason, it only deletes the file rather than delete the row in mysql and delete the file any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/52128-solved-wheres-my-error/ Share on other sites More sharing options...
Orio Posted May 19, 2007 Share Posted May 19, 2007 First, make sure you are connecting to the database using mysql_connect(). Then, after you are sure you are connected, add "or die(mysql_error())" after each mysql function to see if you get any errors. Also, try removing the brackets in the query: <?php mysql_select_db("login", $con) or die(mysql_error()); mysql_query("DELETE FROM '$user' WHERE Name = '$name'") or die(mysql_error()); $FTP_con = ftp_connect("xxx.xxx.xxx.xxx",21); ftp_login($FTP_con,"user","pass"); ftp_delete($FTP_con, $pathpic); ftp_close($FTP_con); ?> Orio. Quote Link to comment https://forums.phpfreaks.com/topic/52128-solved-wheres-my-error/#findComment-257115 Share on other sites More sharing options...
lewis987 Posted May 19, 2007 Author Share Posted May 19, 2007 ok i found where the problem is but i still cant find what the problem is this is what i get now 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 ''admin' WHERE Name = 'Alienware_mtl-1024.jpg'' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/52128-solved-wheres-my-error/#findComment-257127 Share on other sites More sharing options...
lewis987 Posted May 19, 2007 Author Share Posted May 19, 2007 SOLVED! the problem was due to this: mysql_query("DELETE FROM '$user' WHERE Name = '$name'") instead of being- mysql_query("DELETE FROM $user WHERE Name = '$name' LIMIT 1") Quote Link to comment https://forums.phpfreaks.com/topic/52128-solved-wheres-my-error/#findComment-257142 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.