|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-02-27 15:49 UTC] shlomo dot vanunu at roguewave dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 16:00:01 2025 UTC |
Description: ------------ Issue with accessing a legacy db2 database file/table with db2 extension, the table contains column names using the character section code "§". All works on the IBM i green screen and legacy code. The character is supported with IT language feature QSYS2932. The problem is when using the select statement with the individual field names... if called with '* select' - it works: SELCT * from qgpl.testpf1 - works vs. SELECT D§FDT, D§FMODU from qgpl.testpf1 - does not work CREATE TABLE qgpl.testpf1 ( D§ID VARCHAR(2), D§NAME VARCHAR(20), D§NUM VARCHAR(20), D§MEMO LONG VARCHAR, ); Test script: --------------- <?php $database = 'XXXXX'; $user = 'XXXXXX'; $password = 'XXXXXX'; //Establish connection to database $conn = db2_pconnect ($database, $user, $password); if ($conn === false) { die("FAIL : Failed to connect to data base server: $database, with user name : $user and password : $password"); } else { echo "Connection established to database: $database "; echo "<br /><b>The result of the query is:</b>\n" ; //Statement does not work $sql = "SELECT D§ID, D§NAME FROM QGPL.testpf1"; //Statement works //$sql = "SELECT * FROM QGPL.testpf1"; $stmt = db2_prepare($conn, $sql); $result = db2_execute($stmt); if ($result) { echo "Successfully called." . "</br>"; /*while (($row = db2_fetch_assoc($stmt)) !== false) { print_r($row); echo "</br>"; } */ while ($row = db2_fetch_assoc($stmt)) { echo "<pre />" ; printf ("%-16s %-32s\n", $row['D§ID'], $row['D§NAME']); } } } ?>