Are the following codes for mysql or mysqli?


#1

Hey guys!

I have been following this tutorial and I am just wondering if the following if statements do work for mysqli as the tutorial is in mysql? This is only part of my code but the bottom if statement do not make sense to me…

$sql3 = "UPDATE categories
                         SET last_post_date = ?, last_user_posted = ?
                         WHERE id = ?
                         
                         
			            ";

			    $stmt = mysqli_stmt_init($conn);

				if (!mysqli_stmt_prepare($stmt, $sql3)) {
				   echo 'SQL error';
				   
				} else {
				    mysqli_stmt_bind_param($stmt, "ssi", $date, $creator, $cid);
				    mysqli_stmt_execute($stmt);

				    $result3 = mysqli_stmt_get_result($stmt);

				    
					}
                    if (($result) && ($result2) && ($result3)) {
                      header("Location: view_topic.php?id=".$cid."&tid=".$new_topic_id);
                    } else {
					   echo 'There was a problem';
				}


#2

Well, none are MySQL code. It’s all MySQLi (improved) code with prepared statements.
All good.

The if statement checks if any of the three results are “true”. If not, it throws a problem.
The && is just an AND so it checks each item in the if clause and if all are true it moves to the page,
if not it states there is a problem. Make sense now?