943,735 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 611
  • PHP RSS
Feb 23rd, 2008
0

Hot to delete

Expand Post »
Dear members how i can delete a record from a table in php?Give me the code plz...
Last edited by bihartourism; Feb 23rd, 2008 at 3:44 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bihartourism is offline Offline
2 posts
since Feb 2008
Feb 23rd, 2008
0

Re: Hot to delete

there is nothing special or specific to PHP,
use your normal SQL statement with PHP for example with MySQL
PHP Syntax (Toggle Plain Text)
  1. mysql_query("DELETE FROM my_table WHERE id = 1");
Last edited by apsivam; Feb 23rd, 2008 at 4:01 am.
Reputation Points: 12
Solved Threads: 4
Newbie Poster
apsivam is offline Offline
18 posts
since Apr 2007
Feb 23rd, 2008
0

Re: Hot to delete

try modify this code to suit what you want

PHP Syntax (Toggle Plain Text)
  1.  
  2. $name= "record to delete"
  3.  
  4.  
  5. $sql = "DELETE FROM Users WHERE Name= '$name'"or die ("ERROR: Cannot not find user!");
  6.  
  7.  
  8. $result = mysql_query($sql) or die ("Error in query: $sql. ".mysql_error());
Reputation Points: 11
Solved Threads: 2
Light Poster
tirivamwe is offline Offline
36 posts
since Oct 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Dynamic Declaration of Arrays Keys
Next Thread in PHP Forum Timeline: How twitter.com adds twitter@twitter.com to Gtalk to update a user group posts.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC