delete record problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sangeetha
Forum Newbie
Posts: 8
Joined: Sat Mar 11, 2006 12:00 am

delete record problem

Post by sangeetha »

I having problems deleting records from my database .

Here is my code

mysql_query("DELETE FROM tutorials WHERE id='" . $id . "'",$db);

I cant see if there is anything wrong with it.........It doesnt output any error messages but just that there is no records deleted.

Please help.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Code: Select all

echo "DELETE FROM tutorials WHERE id='" . $id . "'"
what does that come out as?

also to make it less confusing, you don't need to concatenate the $id since you're using double quotes

Code: Select all

mysql_query("DELETE FROM tutorials WHERE id='$id'");
would work fine
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
ody
Forum Contributor
Posts: 147
Joined: Sat Mar 27, 2004 4:42 am
Location: ManchesterUK

Post by ody »

Did you mysql_connect() and mysql_select_db('your_db'); ?
sangeetha
Forum Newbie
Posts: 8
Joined: Sat Mar 11, 2006 12:00 am

Post by sangeetha »

Ok i did remove the concatenation and i tried something new...from the online tutorials...i tried assigning the id to $id = $_REQUEST['id']; rather than $id=id..it seems to be working now..thanks again!
Post Reply