php - I want access on the basis of ID. When I click Details Option I want only that ID data will show on page -


if (isset($_get['pro_id'])){     $product_id = $_get['pro_id']; $get_pro = "select * products"; $run_pro = mysqli_query($con, $get_pro); while ($row_pro = mysqli_fetch_array($run_pro)){ $pro_id = $row_pro['product_id'];          $pro_title = $row_pro['product_title'];         $pro_price = $row_pro['product_price'];         $pro_image = $row_pro['product_image'];         //$pro_desc = $row_pro['product_desc'];         echo "         <div id = 'single_product'>         <h3>$pro_title</h3>         <img src='admin_area/product_images/$pro_image' width='400' height='300' />         <p><b>rs. $pro_price</b></p>         <a href='index.php' style='float:left;'>go back</a><br>         <a href='index.php?pro_id=$pro_id'><button style='float:right;'>add cart</button></a>         </div>           ";         }         }                        ?> 

you need specify product want fetch in sql query. 1 using, $get_pro = "select * products"; fetches products. want change this:

$get_pro = "select * products product_id=".((int)$product_id); 

so selects 1 product, 1 passed in $_get['pro_id'].


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -