MySQLi: query VS prepare

前端 未结 2 409
你的背包
你的背包 2020-12-10 05:36

There is something I don\'t quite understand it at all which is prepare and query in mysqli.

This one is using mysqli::query t

2条回答
  •  眼角桃花
    2020-12-10 06:04

    Sorry that this is not an answer, but I am not good enough to actually leave a comment.

    It looks like there is a bug in your second function. Your code won't work correctly for queries that return more than one row. Shouldn't that return statement be:

    while($stmt->fetch()) {
    
        //to dereference
        $row_copy = $parameters;
        $return_array[] = $row_copy;
    
    }
    

    And then the function should end with:

    return $return_array;
    

提交回复
热议问题