![]() ![]() As a side note, there is no error handling on connecting to the database – which is a much more common error than not being able to select one after connecting. You shouldn’t do that anyway, but that is outside the scope of this tutorial (perhaps in a follow up?) – but at least you should protect your database credentials. We would want to abstract creating the connection, so we have a central location to manage it, and likely also keep the credentials in a separate file – especially important if you serve your files directly from the document root directory (web visible). A database connection is created manually with the credentials in the same script running the query.How do you debug this script if you’re a complete newbie to PHP and MySQL? The error suppression operator is used and a failure on selecting the database kills the script with a generic message (which many of you probably seen in the past on actual production websites).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |