php - How to use mysqli bind_result -
im trying use mysqli bind_result null values. $stmt
number of rows greater 0 have data in it.
i dont realy understand value should come bind_result
i have read @ manual http://php.net/manual/en/mysqli-stmt.bind-result.php
and dont explain should put in bind_result
.
should put there column names? if yes, strings? how wanted values?
here code helping:
$sql = "select * comments workout_name = ? , user = ?"; $stmt = $mysqli->prepare($sql) or trigger_error($mysqli->error."[$sql]"); $stmt->bind_param('ss', $workout_name, $user); $workout_name = "rytg"; $user = "tomer"; $stmt->execute(); $stmt->store_result(); $stmt->bind_result($comment, $commented_user); if($stmt->num_rows > 0) { $response["workouts"] = array(); while ($stmt->fetch()) { // temp user array $workouts = array(); $workouts["comment"] = $comment; $workouts["user"] = $commented_user; // push single product final response array array_push($response["workouts"], $workouts); }
}
your problem insufficient error reporting
error_reporting(e_all); ini_set('display_errors',1);
just add these lines @ top of code , informed of exact problem code.
note on production server have turn displaying errors off , logging on
Comments
Post a Comment