Does anyone know if in PHP 7, using PDO the methods are still used
- bind_result()
- store_result()
Or if these methods have been replaced or improved in PDO.
Thank you
Does anyone know if in PHP 7, using PDO the methods are still used
Or if these methods have been replaced or improved in PDO.
Thank you
I tell you that regardless of the PHP version store_result() does not belong to PDO but to mysqli()
As you note in the next line its equivalent would be to use execute()
Now for the case of bind_result() it also belongs to mysqli, if what you are looking for is its equivalent it is bindParam and you use it as follows
As you notice in the previous example I have a variable called id that I pass to the statement with the double colon marker and then just before executing the statement I pass it through the bidnParam() method
The answer is No, since these functions are not specific to the extension
PDO
, but rather they areMySQLi
and have a different purpose.bind_result
Basically, as its name indicates, it will link one or more variables to a statement to store results, these are related to the number of columns that your statement will returnSQL
, that is, a statementYou will need two variables to be bound to store possible results one for name and one for age , the syntax would be
The closest function to this
PDO
isfetchColumn
that it will accept as a parameter the number of the column to obtain from the result.The function
store_result
is simply used to store the result of a statement inbuffer
, subsequent statements like ( fetch ) would get the results directly frombuffer
, although it is often used to check if records exist (which is not quite correct) . The two functions are also often used together, to store tobuffer
and bind variables of a result. egThe equivalent function is the typical
fetch
one with the parameter according to what you want to obtain and in what format