bruceybonus Posted March 11, 2012 Share Posted March 11, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/258682-at-my-wits-end-with-this-white-screen/ Share on other sites More sharing options...
bruceybonus Posted March 11, 2012 Author Share Posted March 11, 2012 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{ } Quote Link to comment https://forums.phpfreaks.com/topic/258682-at-my-wits-end-with-this-white-screen/#findComment-1326110 Share on other sites More sharing options...
Mahngiel Posted March 11, 2012 Share Posted March 11, 2012 You have no disaster reporting. place "echo "fail"; " inside of your }else{ } conditional. if you see fail, there's something wrong with your request. Quote Link to comment https://forums.phpfreaks.com/topic/258682-at-my-wits-end-with-this-white-screen/#findComment-1326117 Share on other sites More sharing options...
bruceybonus Posted March 11, 2012 Author Share Posted March 11, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/258682-at-my-wits-end-with-this-white-screen/#findComment-1326120 Share on other sites More sharing options...
Pikachu2000 Posted March 11, 2012 Share Posted March 11, 2012 You can't mix mysql_* extension functions with mysqli_* extension functions. Pick one or the other. You should be developing with the following directives in your php.ini file. Find the directives, edit their values then restart Apache. error_reporting = -1 display_errors = On Quote Link to comment https://forums.phpfreaks.com/topic/258682-at-my-wits-end-with-this-white-screen/#findComment-1326125 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.