How do i fix uncaught error in php?
I found a system that can generate a report I would like to study this system but when I try to generate the system the login was OK but when I put the password and username this error comes out: Show
Can anyone else tell me what is the problem in this system? image I'm currently using XAMPP V3.2.2
asked Apr 15, 2016 at 2:41
2 If you are using PHP 7 within your XAMPP then it wont work because that code is too old. mysql_select_db was removed in PHP 7. http://php.net/manual/en/function.mysql-select-db.php You will need to install PHP 5 to use that software. Edit: Pratik Solanki is correct also. The database is being connected using mysqli so depending on the other code in the system you can either change the database connect statement to mysql_connect and use PHP 5 (old mysql connector not recommended) or change all the database statements to use mysqli instead in which case no PHP changes are needed (recommended) answered Apr 15, 2016 at 2:52
Ruben FunaiRuben Funai 6095 silver badges5 bronze badges You forgot to include the database while connecting using mysqli_connect function. In your code, you declared a $mysql_database but you didn't use that. Code:
answered Apr 15, 2016 at 3:05
claudiosclaudios 6,5178 gold badges44 silver badges86 bronze badges You connected to database via mysqli module of php and you are trying to select your database via mysql module of php. Correct way to use it would be like this :
mysqli can be used with the mysql native drivers and mysql can be used via the default libraries provided. Both are different and the only small mistake you made was making connection with mysqli and selecting db with mysql. Solution to this is making the whole connection along with selection of db via mysqli function answered Apr 15, 2016 at 3:13
Not the answer you're looking for? Browse other questions tagged php mysql or ask your own question.mysqli_db_query($db, "INSERT INTO CJ_UsersOnline VALUES ('$t_stamp','$REMOTE_ADDR','$PHP_SELF')") or die("Database INSERT Error"); Not necessary a solution to your question, but another problem you have. Educative Answers Team Fatal errors crash the program. There are three types of fatal errors in PHP:
The following code tried to call a function name without declaring the function. This gives a fatal error:
Solution
Copyright ©2022 Educative, Inc. All rights reserved What is uncaught error in PHP?When an exception is thrown, the code following it will not be executed, and PHP will try to find the matching "catch" block. If an exception is not caught, a fatal error will be issued with an "Uncaught Exception" message.
What is a solution for fatal error in PHP?Solution. Look for the undeclared variables as given in the error. If you are using inbuilt functions, ensure that there is no typo and the correct function is called. Check if the spellings are correct.
What does fatal error uncaught error mean?What Does Fatal Error Mean? A fatal error is an error that causes a program to terminate without any warning or saving its state. A fatal error, upon occurring, aborts the application currently running, and may cause the user to lose any unsaved changes made in the program.
How do I fix undefined errors in PHP?Steps to Resolve the Error of Calling to Undefined Function in PHP. Verify that the file exists. ... . Verify that the file has been included using the require (or include ) statement for the above file on the page. ... . Verify that the file name is spelled correctly in the require statement.. |