xref: /PHP-7.2/ext/odbc/tests/odbc_exec_002.phpt (revision 3201292c)
1--TEST--
2odbc_exec(): Getting data from query
3--SKIPIF--
4<?php include 'skipif.inc'; ?>
5--FILE--
6<?php
7
8include 'config.inc';
9
10$conn = odbc_connect($dsn, $user, $pass);
11
12odbc_exec($conn, 'CREATE DATABASE odbcTEST');
13
14odbc_exec($conn, 'CREATE TABLE FOO (TEST INT)');
15
16odbc_exec($conn, 'INSERT INTO FOO VALUES (1)');
17odbc_exec($conn, 'INSERT INTO FOO VALUES (2)');
18
19$res = odbc_exec($conn, 'SELECT * FROM FOO');
20
21var_dump(odbc_fetch_row($res));
22var_dump(odbc_result($res, 'test'));
23var_dump(odbc_fetch_array($res));
24
25odbc_exec($conn, 'DROP TABLE FOO');
26
27odbc_exec($conn, 'DROP DATABASE odbcTEST');
28
29?>
30--EXPECTF--
31bool(true)
32string(1) "1"
33array(1) {
34  ["TEST"]=>
35  string(1) "2"
36}
37