Jump to content

[SOLVED] Wheres my error?


lewis987

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/52128-solved-wheres-my-error/
Share on other sites

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.

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

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.