Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between mysqli_prepare() and mysqli_stmt_prepare()?

Tags:

php

mysqli

This article of the PHP manual uses mysqli_prepare() here but mysqli_stmt_* for everything else.

However, in this article of the PHP manual, it uses mysqli_stmt_prepare()

What is the difference between these? Can I use either? And if mysqli_prepare() is valid, does that mean mysqli_bind_param() is valid?

OK, this article for mysqli_bind_param() says it's an alias for mysql_stmt_bind_param(). I guess it's safe to assume it's the same with mysqli_prepare() and the rest of the mysqli_* functions?

like image 504
cantsay Avatar asked Jan 20 '26 15:01

cantsay


1 Answers

mysqli_prepare() is basically just a shortcut for

$stmt = mysqli_stmt_init();
$stmt->prepare($sql);
like image 78
Marc B Avatar answered Jan 23 '26 06:01

Marc B