mysqli::bind_param(); variables

前端 未结 2 1769
遥遥无期
遥遥无期 2021-01-23 08:33
$mysqli = new mysqli(\'localhost\', \'my_user\', \'my_password\', \'world\');

/* check connection */
if (mysqli_connect_errno()) {
    printf(\"Connect failed: %s\\n\",         


        
2条回答
  •  迷失自我
    2021-01-23 09:25

    bind_param accepts references, if your unsure what references exactly are then click here for the extract named as "references explained"

    This does mean, it is valid to set your variables after the bind_param but then again, it's down to preference how you wish to do it. I for one, prefer declaring the variables prior to the bind

    Little observation

    The variables are declared prior to the execute, and as PHP works from top to bottom processing. When the variables are actully needed (on the execution) they would have already been set, if you declare your variables after the execute() you will be prompted with SQL Failures and other unwanted php errors

提交回复
热议问题