Code:
- <html><form method="post" action=recordaccess.php>
- Library (schema): <input type="text" name="lib"><br>
- File (table): <input type="text" name="tbl"><br>
- <input type="reset"> <input type="submit"
- value="Display records">
- </form>
- </html>
-
- ===========================
-
- <html>
- <body>
- <?php
- $i5_server_ip = "LOCALHOST";
- $i5_uname = "PHPUSER";
- $i5_pass = "password";
-
-
- $conn = i5_connect($i5_server_ip, $i5_uname, $i5_pass);
- if ($conn === false) {
- print ("<br>FAIL : Failed to connect to server : $i5_server_ip, with
- user name : $i5_uname and password : $i5_pass");
- $errorTab = i5_error();
- var_dump($errorTab);
- die();
- }
- $dbfile = $_POST['tbl'];
- $dblib = $_POST['lib'];
- $file = i5_open("$dblib/$dbfile", $conn);
- if ($conn === false) {
- $errorTab = i5_error();
- var_dump($errorTab);
- die();
- }
- $fields = i5_list_fields($file);
- print "<table border=1 cellpadding=3><tr bgcolor=
- foreach ($fields as $value) {
- print "<th>$value</th>";
- }
- print "</tr>\n";
-
- $rec = i5_fetch_row($file, I5_READ_FIRST);
- while ($rec) {
- foreach ($rec as $value) {
- print "<td>$value</td>";
- }
- print "</tr>\n";
- $rec = i5_fetch_row($file, I5_READ_NEXT);
- }
- print "</table>";
- ?></body></html>
|
|