Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php、mysql中从单列中获取多值数据_Php_Mysql_E Commerce - Fatal编程技术网

如何在php、mysql中从单列中获取多值数据

如何在php、mysql中从单列中获取多值数据,php,mysql,e-commerce,Php,Mysql,E Commerce,我想从单个列中获取多个值的数据,但只有最后一个(price=399)在第页可见 我正在使用此代码,请帮助我获取所有3个价格的数据 <a href="show_products.php?price=149&price=299&price=399"> if(isset($\u GET['price'])&&&$\u GET['price'])) { $productprice=$\u获取['price']; $productprice_结果=mysql_查询(“从产

我想从单个列中获取多个值的数据,但只有最后一个(price=399)在第页可见

我正在使用此代码,请帮助我获取所有3个价格的数据

<a href="show_products.php?price=149&price=299&price=399">

if(isset($\u GET['price'])&&&$\u GET['price']))
{ 
$productprice=$\u获取['price'];
$productprice_结果=mysql_查询(“从产品中选择*,其中价格=$productprice”);
而($productprice_rows=mysql_fetch_array($productprice_result)){
$productid=$productprice_行[“product_id”];
$productsql=$productsql.“和价格=$productprice”;
}

试试看

@vivek这里是-->我想要数据库查询(isset($\u GET['price'])&&$\u GET['price']”){$productprice=$\u GET['price'];$productprice\u result=mysql\u查询(“select*from products where price=$productprice”);$productprice\u rows=mysql\u fetch数组($productprice\u result);$productid=$productprice\u行[“productid”];$productsql=$productsql.”和price=$productprice”}相同的结果,只显示399个产品。php代码是这样的,是否正确-->您在一个名称中获取了不同的价格值,即price,请使用不同的名称尝试不同的价格值
    if (isset($_GET['price']) && $_GET['price']<>"") 
{ 
$productprice= $_GET['price'];
 $productprice_result=mysql_query("select * from products where price=$productprice"); 

while($productprice_rows=mysql_fetch_array($productprice_result)){ 

$productid=$productprice_rows["product_id"];
 $productsql=$productsql. "and price=$productprice "; 
}