Warning: mysqli::__construct(): (HY000/2002): No such file or directory in /home/vol16_1/epizy.com/epiz_32278910/htdocs/dev/Distweb/index.php on line 99
Thanks for ur reply. I tried checking the connection error but I can’t because $db->connect_error cannot execute since $db = new sqli(...) caused an error.
The error (2002) Can’t connect to … normally means that there is no MySQL server running on the system or that you are using an incorrect Unix socket file name or TCP/IP port number when trying to connect to the server.
Another thing to note: in the Distweb/index.php file, I see you’re defining the configuration in the global scope on line 88, but the mysqli call on line 102 is made within the signUp function.
But code within functions cannot access variables defined outside the function. So all the configuration variables cannot be used there.
You can import them using the global keyword (but that’s considered bad design), or by defining the configuration values as constants.
And you can use either the procedural style mysqli_connect or object-oriented style new mysqli. They work the same but are accessed a bit differently.