Disreguard that last email. I think I may have had problems with Windows
case insensativity but don't know for sure. Anyway, I renamed the variables
in removeItem function and all works well. Even the return statements ;) -
(I was grasping a bit in the last email).
I thought I would send along the code in case I created more problems than I
solved....let me know. Here is the function - notice $id is renamed to
$item in most cases:
function removeItem($item)
{
global $DatabaseLink;
/*
** we need to have the skus that are children of this item.
*/
$Query = "SELECT ID " .
"FROM sku " .
"WHERE Item=" . intval($item);
if(!($DatabaseResult = mysql_query($Query, $DatabaseLink)))
{
//addToLog("Couldn't find a random item!",
//LOG_IMPORTANT, __FILE__, __LINE__);
return(FALSE);
}
/*
** Generate comma separated list.
*/
if ( list($id) = mysql_fetch_row($DatabaseResult) )
{
$skuList = $id;
while ( list($id) = mysql_fetch_row($DatabaseResult) )
{
$skuList .= ", $id";
}
}
/*
** Delete SKUs.
*/
$Query = "DELETE FROM sku WHERE Item=" . intval($item);
if(!mysql_query($Query, $DatabaseLink))
{
return(FALSE);
}
/*
** Delete from sku_variation for each of the skus.
*/
$Query = "DELETE FROM sku_variation ";
$Query .= "WHERE SKU IN (" . $skuList . ")";
if(!mysql_query($Query, $DatabaseLink))
{
return(FALSE);
}
/*
** Delete item to department associations.
*/
$Query = "DELETE FROM department_item WHERE Item=" . intval($item);
if(!mysql_query($Query, $DatabaseLink))
{
return(FALSE);
}
/*
** Delete item.
*/
$Query = "DELETE FROM item WHERE ID=" . intval($item);
if(!mysql_query($Query, $DatabaseLink))
{
return(FALSE);
}
return(TRUE);
}
_______________________________________________
FreeTrade-dev mailing list
[EMAIL PROTECTED]
http://share.whichever.com/mailman/listinfo/freetrade-dev