Page 1 of 1

delete record problem

Posted: Sun Mar 12, 2006 3:21 am
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.

Posted: Sun Mar 12, 2006 3:50 am
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

Posted: Sun Mar 12, 2006 5:32 am
by ody
Did you mysql_connect() and mysql_select_db('your_db'); ?

Posted: Mon Mar 13, 2006 1:45 am
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!