php - Function that is supposed to return a value from query -
i have function use value query. might doing wrong execution, or syntax. when try run query data in it, it's fine, 1 returns 0 items.
public function get_modified_event ($type, $id, $employee_id) { global $dbh; $sql =<<<sql select outlook_id dba.events spine_item_type = :type , spine_id = :id , employee_id = :employee_id sql; $stmt = $dbh->prepare( $sql ); $stmt->execute( array( 'id' => $id, 'type' => $type, 'employee_id' => $employee_id, ) ); $rows = $stmt->fetchall( \pdo::fetch_assoc ); return $rows['outlook_id']; }
you try reworking portion of code uses kind of format:
$stmt = $dbh->prepare( $sql ); if ($stmt->execute( /* array goes here */ )) { $rows = $stmt->fetchall( pdo::fetch_assoc ); if ($rows !== false){ print_r($rows); } else if ( $stmt->rowcount() === 0) { echo "the info provided unknown database"; } }
hopefully you'll meaningful results.
Comments
Post a Comment