$SQL_command="INSERT IGNORE INTO listEntries (listId, productId) VALUES ((SELECT id FROM `lists` ORDER BY creationTime DESC LIMIT 1), ".$productId.")";
else
$SQL_command="INSERT IGNORE INTO listEntries (listId, productId) VALUES ((INSERT INTO `lists` (creationTime) VALUES (".round(microtime(true)*1000).") RETURN @id, ".$productId."))";
if(DBLink::getDbLink()->query($SQL_command))
echo"Product added to list.<br>";
else
echo"Product could not be added to list.<br>";
}
else
echo"Select a product.";
}
functionremoveFromList($productId)
{
if($productId>0)
{
if(oneListExists())
{
$SQL_command="DELETE FROM listEntries WHERE listId=(SELECT id FROM `lists` ORDER BY creationTime DESC LIMIT 1) AND productId=".$productId;
if(DBLink::getDbLink()->query($SQL_command))
echo"Product removed from list.<br>";
else
echo"Product could not be removed from list.<br>";
}
}
else
echo"Select a product.";
}
functiononeListExists()
{
$SQL_command="SELECT COUNT(id) as listAmount FROM lists";
$SQL_command="SELECT * FROM listEntries INNER JOIN products ON listEntries.productId=products.id INNER JOIN storeTypes ON products.storeTypeId = storeTypes.id WHERE listEntries.listId=(SELECT id FROM `lists` ORDER BY creationTime DESC LIMIT 1) ORDER BY storeTypes.name, products.name ASC";