最终,这段代码可以正常工作了!
<?php $host = 'localhost'; $user = 'root'; $pass = '1234'; $data = 'test'; $mysqli = new mysqli($host, $user, $pass, $data); if (mysqli_connect_errno()) { printf("Connect failed: %sn", mysqli_connect_error()); exit(); } if ($stmt = $mysqli->prepare("SELECt * FROM sample WHERe t2 LIKE ?")) { $tt2 = '%'; $stmt->bind_param("s", $tt2); $stmt->execute(); $meta = $stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($stmt, 'bind_result'), $params); while ($stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } $result[] = $c; } $stmt->close(); } $mysqli->close(); print_r($result); ?>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)