Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $database = '*LOCAL';
- $username = 'somebody';
- $password = 'something';
- $options = [
- 'autocommit' => DB2_AUTOCOMMIT_ON,
- 'i5_naming' => DB2_I5_NAMING_ON,
- 'i5_libl' => 'LIB1 LIB2 LIB3',
- ];
- $dbconn = db2_pconnect($database, $username, $password, $options);
- if (!dbconn) {
- die();
- }
- $sql = 'SELECT stuff FROM sometable WHERE x = ? ORDER BY seq#';
- $stmt = db2_prepare($dbconn, $sql);
- if (!$stmt) {
- die();
- }
- $params = ['blah'];
- $result = db2_execute($stmt, $params);
- if (!$result) {
- die();
- }
- while ($row = db2_fetch_array($stmt)) {
- // do something with data
- }
- // free the statement
- $stmt = '';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement