Scenario:

Query the database table to get the result set:

$Query = "SELECT * FROM $Tablename";

$Result = mysql_query($Query);  //Returns the result set

if (mysql_num_rows($Result) == 1)    //if row I'm looking for is found

{
   while ($row = mysql_fetch_array($Result, MYSQL_ASSOC)) {
$query = "DELETE FROM $Tablename WHERE [primary_key_field[s]] = '{$row['primary_key_result']}'";
      mysql_query($query);
   }
}

Since I'm not sure on your database structure, I'm not really able to fill in the blanks there... not to mention you don't have a WHERE clause on that query, and you're checking to make sure there's only one row; unless your table has only one row in it, it's likely nothing will happen. Also, if you're looking to delete them, why not just replace your "SELECT * FROM" to a "DELETE FROM ..."?

--
Rick
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to