Today, I had an issue with inserting a database item that had a single quote. Learning about real_escape_string in the past, I knew that was the function to use. Little did I know how effective this would be for future projects. So if you ever run into this issue in the future while using MySQLi, try using this snippet below. It helped me solve the problem I was facing! Leave comments below if you have any other methods or questions.
$yournewvariable = mysqli_real_escape_string($con, $variable_name);