php如何获取购物车的typeID和ProductID

php如何获取购物车的typeID和ProductID,php,function,shopping-cart,Php,Function,Shopping Cart,嘿,我试图用php iv制作一个购物车,我和班上的其他学生交谈,他们认为出于某种原因,我的getProductByTypeId查询有问题。。。它从数据库中提取除我的ProductID之外的所有内容 下面是我的功能 function getProductsByTypeID($TypeID){ //pull in global connection global $connection; //execute query to select all product types $query="se

嘿,我试图用php iv制作一个购物车,我和班上的其他学生交谈,他们认为出于某种原因,我的getProductByTypeId查询有问题。。。它从数据库中提取除我的ProductID之外的所有内容

下面是我的功能

function getProductsByTypeID($TypeID){

//pull in global connection
global $connection;

//execute query to select all product types
$query="select * from product where TypeID = ".$TypeID;
$result = mysql_query($query, $connection);
testQuery($result);

//return list of customers
return $result;
}

您得到的结果是什么?您应该包括
testQuery()
的代码,以便我们可以看到它的功能。此外,如果你想得到指导而不是一个直接的答案,你还可以打开一个名为“家庭作业”的标签。有时候,提示对你来说更好,这样你就可以自己学习并真正理解答案。