954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

MySQL - Some Records Not Deleting

Im trying to delete records. Most delete ok but some don't and Im completly lost as to why...

The information Im storing are just URLs.

Could it be to do with some irregular characters within these URLs?

Is there a recomended way to store a URL?

Please help me out. Its quite a major flaw in my script

I think it probably is the irregular characters.

Here are the records which wont delete

http://www.theflickzone.com/showthread.php?p=24961#post24961 http://www.theflickzone.com/tags.php?tag=Google+Video http://www.theflickzone.com/showthread.php?p=25067#post25067 http://www.theflickzone.com/member.php?find=lastposter&f=34 http://www.theflickzone.com/member.php?find=lastposter&f=31

Well there are just some. There are many more.

Thanks :)

!Unreal
Junior Poster
112 posts since Dec 2007
Reputation Points: 11
Solved Threads: 2
 

What error is returned?
Add or die(mysql_error()); to the closing bracket of the query as so:

mysql_query("....")or die(mysql_error());
Will Gresham
Master Poster
755 posts since May 2008
Reputation Points: 96
Solved Threads: 125
 

There isn't one :(

EDIT: Just for a bit of context...

<?php
include('includes/config.php');
$referer = $_SERVER['HTTP_REFERER'];
$addtolist = $_GET['add'];
mysql_query("DELETE FROM spider WHERE url='$addtolist'")or die(mysql_error());
header("Location: $referer");
mysql_close($con);
?>
!Unreal
Junior Poster
112 posts since Dec 2007
Reputation Points: 11
Solved Threads: 2
 

Have you tried echoing $addtolist to make sure that it contains the value expected?

Will Gresham
Master Poster
755 posts since May 2008
Reputation Points: 96
Solved Threads: 125
 

Yeah. Im expecting to get these characters. I just need to know how to handle them.

!Unreal
Junior Poster
112 posts since Dec 2007
Reputation Points: 11
Solved Threads: 2
 

I managed to work this one out.

You have to work with the URLs in an encoded form. Using rawurlencode and rawurldecode.

Thanks for your help though :)

!Unreal
Junior Poster
112 posts since Dec 2007
Reputation Points: 11
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You