How to check if Insert query succeeded in PHP

check-database-query-success-php

Here is another post to help out PHP beginners. So you created your connection object, wrote your query, created a statement object, bound your variables to protect yourself against injection attacks etc. Now you execute your query and wanna see if

Read More How to check if Insert query succeeded in PHP

How to detect which button was clicked and which button submits form data in PHP

detect-which-button-clicked-php

This is will a PHP basics posts. I see this question is asked a lot by the beginners so here it goes. Let’s see how you can detect which button was clicked in a PHP form. Detecting Which Button was

Read More How to detect which button was clicked and which button submits form data in PHP

PHP Fatal error: Call to undefined method mysqli_stmt::get_result()

I had this error message when I deployed my PHP website to my cPanel PHP hosting company. This message was displayed on all the pages using “get_result()” on a mysqli statement. PHP Fatal error: Call to undefined method mysqli_stmt::get_result() Apparently mysqlnd

Read More PHP Fatal error: Call to undefined method mysqli_stmt::get_result()

PHP Prepared Statements – Part 2

I have already written a post titled “Php Prepared Statements” but it was very brief and did not explain the workings of Prepared Statements, neither did it mention the PROS of using Prepared Statements. In this post, I want to provide

Read More PHP Prepared Statements – Part 2

PHP – Use call_user_func_array for Variable Number of Parameters (arrays) in Prepared Statements

You will understand how important this method is when you want to bind a variable number of arguments as an array to your prepared statements with MySQLi. That is what happened with me 🙂 Yeah, unfortunately it is not possible to

Read More PHP – Use call_user_func_array for Variable Number of Parameters (arrays) in Prepared Statements

PHP Shorthand IF Statements (Ternary Operator)

You know If statements. They are almost all the same in most of the programming languages. In PHP, their structure is also just the way you would expect them to be 🙂 Below is a very simple if statement in

Read More PHP Shorthand IF Statements (Ternary Operator)

Using Transactions in PHP

Transactions… They are an essential part of programming if you are performing dependent database operations. By dependent database operations, I mean something like this scenario: A) Add a record to table b B) Add a log for this addition operation

Read More Using Transactions in PHP

Maximum Hash Cost Your Server Can Efford for PHP password_hash Method with Blowfish Algorithm

Hashing…Why do we need it? We need it to stop bad guys from stealing the passwords of our users in case they are able to steal our database records. PHP 5.5 has a native password hashing API that you can use for

Read More Maximum Hash Cost Your Server Can Efford for PHP password_hash Method with Blowfish Algorithm