Guys why when I write to transfer a function, at the moment get_epson($connection); On my page where it should appear, the page just becomes white. Here is the full code:

 <?php **$connection** = mysqli_connect('localhost', 'a0106522', '4101994fucking123', 'a0106522_Epson'); if(mysqli_connect_errno()) { echo 'ПРИВЕТ ('.mysqli_connect_errno().'): '. mysqli_connect_error(); } <?php function **get_epson($connetion)** { $sql = "SELECT * FROM epson"; $result = musqli_query($connection, $sql); echo '<pre>'; var_dump($result); echo '</pre>'; } **get_epson($connection);** ?> 
  • $ connection = mysqli_connect ('localhost', 'a0106522', '4101994fucking123', 'a0106522_Epson'); if (mysqli_connect_errno ()) {echo 'HELLO (' .mysqli_connect_errno (). '):'. mysqli_connect_error (); - Metallistener
  • function get_epson ($ connetion) {$ sql = "SELECT * FROM epson"; $ result = musqli_query ($ connection, $ sql); echo '<pre>'; var_dump ($ result); echo '</ pre>'; } get_epson ($ connection); if (isset ($ connection)) {echo 'Hello'; } else {echo 'There is nothing'; } - Metallistener
  • 2
    The question is "edit" link, write all the additions in the question text. And indent 4 spaces before the code - then it is formatted as a code (you can select the code and press the special button {} at the top of the editor for the correct design) - Mike

1 answer 1

Obviously, you have some kind of error in the code, but it is not displayed. You need to enable the error log, otherwise it will be very difficult to correct the errors. This can be done in different ways:

1) I recommend: Enable the display of all errors and warnings in the .htaccess file

 php_value display_errors 1 php_value display_startup_errors 1 php_value error_reporting E_ALL 

Add these lines to the .htaccess file in the site root.

2) (If you have access to configs) Enable the display of all errors and warnings in the php.ini :

 error_reporting = E_ALL display_errors = On display_startup_errors = On 

3) Enable the display of all errors and warnings in the code of PHP scripts.

You can enable notifications and warnings by adding the following lines to the beginning of the desired .php file:

 ini_set('error_reporting', E_ALL); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); 

This method may not cover all types of errors, therefore I do not recommend it.

  • created error.htaccess file in the root of the site and put it into it - Metallistener
  • php_value display_errors 1 php_value display_startup_errors 1 php_value error_reporting E_ALL - Metallistener
  • without opening and closing php - Metallistener
  • so be right? - Metallistener
  • @ Dmitry No, the file should be called .htaccess . Those. file name starts with a dot - Crantisz