The posted code should have been giving you two php Warning error messages about undefined constants. What output were you getting?
Next, I have reviewed some of your recent threads and have some suggestions -
You ALWAYS need to have error handling for statements that can fail. This is different from php errors. For database statements, you should use exceptions for error handling and in most cases let php catch and handle the exception where it will use its error related settings to control what happens with the actual error information (database errors will get displayed/logged the same as php errors.) The exception to this rule is when inserting/updating data that could be duplicated or out of range. In this case, your code should catch the exception, test the error number, and if the error is something that your code can handle, setup a user error message indicating what exactly was wrong with the data being inserted/updated. To use exceptions for errors for the mysqli extension, add the following line of code before the point where you make the database connection -
The two statements setting the error_reporting and display_errors should be in the php.ini on your system. Some of the blank pages you have been getting are due to php syntax errors, which won’t be reported/displayed when you have these settings in your code, because your code never runs in this case. Also, by putting these settings only in the php.ini, you can change them at a single point and you won’t have to remember to remove them from your code when you move it to a live server (you don’t want to display php errors on a live site since that gives hackers useful information when they intentionally do things that trigger errors.)
As has been mentioned several times, switch to the PDO extension. It is both simpler and more consistent than the msyqli extension. It does use OOP notation, but you don’t need to understand OOP to use it. Calling an OOP method is just a slightly different syntax from calling a procedural function.
The Notice (Notice : Use of undefined constant sql - assumed ‘sql’ on line 10) tells you the issue. You need to use $sql, not sql at the end there.
That should let you proceed to see if there are any further errors.