I'm tryng to pass parameters in the url, but I receive this error: *implode(): Invalid arguments passed in *
I know that the cause is that I pass a string as parameter instead of an array, but how can I do to pass the array directly?
My code:
$all_prod_cat="SELECT * FROM products GROUP BY product_category";
$run_all_prod_cat = mysqli_query($con,$all_prod_cat);
$sql= "SELECT * FROM products";
if(isset($_GET['product_category']) && $_GET['product_category']!="")
{
$risperpag = 16;
$limit = $risperpag * $_GET['p'] - $risperpag;
$prod_cat = $_GET['product_category'];
$sql.=",categories WHERE product_category IN ('".implode("','",$prod_cat)."') AND product_category = cat_id LIMIT $limit,$risperpag";
$get_cat_pro_total = "SELECT * FROM products,categories WHERE product_category IN ('".implode("','",$prod_cat)."') AND product_category = cat_id";
$run_cat_pro_total = mysqli_query($con,$get_cat_pro_total);
$num_cat_pro_total = mysqli_num_rows($run_cat_pro_total);
$npag = ceil($num_cat_pro_total / $risperpag);
$p = $_GET['p'];
echo "<ul>";
if($p!=1)
{
echo '<li class="numPagine"><a href="lista_prodotti.php?sort_price=&product_category='.urlencode($stringa).'&p='.($p-1).'">← Indietro</a></li>';
}
for($i=1;$i<=$npag;$i++){
if($p==$i)
{
echo '<li class="numPagine pagina_attuale">'.$i.'</li>';
}
else
{
echo '<li class="numPagine"><a href="lista_prodotti.php?sort_price=&product_category='.urlencode($stringa).'&p='.$i.'">'.$i.'</a></li>';
}
}
if($p!=$npag)
{
echo '<li class="numPagine"><a href="lista_prodotti.php?sort_price=&product_category='.urlencode($stringa).'&p='.($p+1).'">Avanti →</a></li>';
}
echo "</ul>";
}
The problem is when I set the urlencode parameter, I tried to serialize, but I get an other error. I think I should unserialize, but I don't know the exact point.
Thanks in advance.