0

I have looked at our posts regarding this problem, however, the posts just suggest to use mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT) instead of error_reporting(E_ALL). I have made these changes which indeed removed the error message, but now nothing appears on my webpage, it is just a blank white page, even though it has a few forms on it. So i started using error_reporting(E_ALL) once again

I was wondering if there is another reason for this error. It is a simple select statement that is causing this problem, The php file consists of 4 forms and has a insert on duplicate key statement just before it.

   $prod_sel = $dbc->query("SELECT * FROM Product");
        $prod_sel->data_seek(0);
        while ($output = $prod_sel->fetch_assoc()) {
            $prod_run .= $output['Product_Name'] . '<br>';
            $_SESSION['Product_Name'] = $output['Product_Name'];
        }
       //session_start does not work here
        print "Restaurant is :" . $_SESSION['Product_Name'];
        $prod_sel->free();
        $prod_sel->close();
JJ123
  • 69
  • 1
  • 7
  • Who said you have to *change* one for another? Any reason to ban one in favor of another? – Your Common Sense Apr 07 '16 at 17:02
  • @YourCommonSense the post said error_reporting(E_ALL) causes issues with select statements, that do not require a index. It went on to say mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT) solves this – JJ123 Apr 07 '16 at 17:05
  • Error_reporting has **ABSOLUTELY** nothing to do with select statements and causes **nothing** of the kind. You ought to take it back in your code – Your Common Sense Apr 07 '16 at 17:08

2 Answers2

0

Your Product table has no column indexed, you should fix it for better performance
You can always disable this mysqli error just by adding this code

mysqli_report(MYSQLI_REPORT_INDEX);

You can find here the complet list about Enabling/Disabling the internal report functions
I suggest you to read this good article about PHP & MYSQL Communication

Halayem Anis
  • 7,654
  • 2
  • 25
  • 45
  • That is why i am confused my Product table has a primary key, a index key and two unique keys. Disabling errors, makes everything on my page disappear. – JJ123 Apr 07 '16 at 16:10
  • article is very useful thank you – JJ123 Apr 07 '16 at 16:13
-1

i think you have 2 problems.

  1. You don't have any exception catching mecahinsm
  2. Your Product table has no any primary column

Try to fix your Product table structure make some column auto incremant or make some column primary which is already exists

Santa's helper
  • 976
  • 8
  • 21