Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.