Jump to content

bruceybonus

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Everything posted by bruceybonus

  1. Thank you for the reply! I have tinkered a little: <?php session_start(); include "connect.php"; if (isset($_GET['id'])){ $product_id = $_GET['id']; $productquery="SELECT product_Name, Category, Price FROM product WHERE product_ID= $product_id"; $prodresult = mysqli_query($productquery); while ($row = mysqli_fetch_array($prodresult, MYSQL_NUM)){ echo "<div><p>Name: $row[0]</p><p>Category: $row[1]</p><p>Price: $row[2]</p></div>"; } echo "<div><a href=\"cart.php?action=add&product=$product_id\">add to basket</a></div>"; echo "fail"; } mysqli_close($_SESSION['conn']); //close database connection ?> I now see the link to add to the basket. I am also having problem with a page showing every product: $prosql="SELECT product_ID, product_Name, Category, Price, Information FROM product"; $proresult=mysqli_query($_SESSION['conn'], $prosql); $productcount = mysql_num_rows($proresult); // count the output amount if ($productcount != 0) { The above sql is coming back with a result of 0 every time? I'm at a massive brick wall.
  2. Sorry guys wrong file and couldn't find the edit <?php session_start(); include "connect.php"; if (isset($_GET['id'])){ $data = $_GET['id']; $prodresult = mysql_query("SELECT product_ID, product_Name, Category, Price, Information from product"); while ($prow = mysql_fetch_array($prodresult, MYSQL_NUM)) { echo "<p> $prow['product_Name']"; } else{ }
  3. Hello! Incredibly new to PHP, so if this problem is a clear error i apologise. I am developing a page which will display a product based on what is clicked as a result of a search, my problem is that no matter that happens I cannot display anything from the Products table in my database: <?php session_start(); include "connect.php"; $prodsql="SELECT product_ID, product_Name, Category, Price, Information from Product ;"; $prodresult = mysqli_query($_SESSION['conn'], $prodsql); while ($prow = mysql_fetch_array($prodresult, MYSQL_NUM)) { echo "<p> $prow['product_Name']"; } else{ } What am i missing? The connect.php works as I can successfully login and register members. Thank you
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.