[thelist] something wrong with my SQL query

Tom Dell'Aringa pixelmech at yahoo.com
Wed Nov 20 11:11:01 CST 2002


Hi all, I am trying to disallow a deletion of a category if a
category exists already in a table. Here is my code:

//first check and see if the category is being used. If it is,
disallow deletion

$result = @mysql_query("SELECT item FROM menuitem WHERE categoryID =
$id");
if($result)
{
	$message = "Oops! You cannot delete that category, it is being used!
If you really wish to delete this category, you must first remove it
from any menu item that refers to it. - ";

	header("Location: manage_cat.php?message=".$message);
}

I added a test category that is NOT in the menuitem table. Yet it
always tells me I can't delete it because it exists. I'm guessing
this has something to do with the way I set it up (if($result)??)

When I print out the $result I get "RESOURCE id" instead of the sql
so I'm wondering if my logic is wrong..

TIA

Tom

=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com



More information about the thelist mailing list