![]() |
a lil mysql help? (using phpMyAdmin)
i'm trying to delete all the rows with "December 4, 2003" in the Date field... but when i run the below code, it just refreshes to the page, but doesn't delete anything:
DELETE FROM `crtgpcache` WHERE Date='December 4, 2003' what should i change it to so it'll delete all the damn rows? thx |
what type is the field, date or datetime?
and try using '2003-12-04' |
If your code is done properly really, it should be done in mktime() dates.
Inwhich case... the dates in the database might look like this "1070524800" So your query should look like "WHERE Date = '1070524800' otherwise, as Lane said, it could be a date field which would be done as "2003-12-4" or something like that. |
its a VarChar field... and i KNOW the data within hundreds of these fields, the Date field = "December 4, 2003".. i want them deleted! and my query in my initial post is not working.
|
Do a SELECT COUNT(*) FROM crtgpcache WHERE Date = "December 4, 2003" This should return the number of rows that satsify your query. If nothing gets returned then you know there is nothing wrong with your DELETE query but rather there are no rows in the database that satisfy your condition.
|
Quote:
|
Quote:
|
Yeah, whitespaces could mess things up. Whenever I put something into the database and I know it's not supposed to have a space in the beginning or at the end (like dates, IP addresses, etc...) I use PHP's trim() function (http://www.php.net/manual/en/function.trim.php) to remove whitespace(s) from the beginning and the end of the string. This saves my butt all the time.
|
| All times are GMT -7. The time now is 11:56 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123