howto Verbindung zu as400 mit PHP

Ich versuche eine Verbindung zu meinem AS400 mit V5R3 mit PHP, mit diesem code :

<?php
$server="Driver={Client Access ODBC Driver (32-bit)};System=xxx.xxx.xxx.xxx;
Uid=user;Pwd=password;"; #the name of the iSeries
$user="user"; #a valid username that will connect to the DB
$pass="password"; #a password for the username

$conn=odbc_connect($server,$user,$pass); #you may have to remove quotes

#Check Connection
if ($conn == false) {
echo "Not able to connect to database...<br>";
}

#Query the Database into a result set - 
$result=odbc_exec($conn,"SELECT * FROM LIBRARY.V5TDOC0L WHERE T§DTDO = 20120319");

if (!$result)
  {exit("Error in SQL");}
echo "<table><tr>";
echo "<th>T§NDOC</th>";
echo "<th>T§DTDO</th></tr>";
while (odbc_fetch_row($result))
  {
  $ndoc=odbc_result($result,2);
  $dtdo=odbc_result($result,3);
  echo "<tr><td>$ndoc</td>";
  echo "<td>$dtdo</td></tr>";
  }
echo "</table>";

#close the connection
odbc_close($conn);
?>

Bekam ich diese Fehlermeldung :

Warning: odbc_exec() [function.odbc-exec]: SQL error: [IBM][Programma di controllo ODBC-di System i Access][DB2-pro i5/OS]SQL0104 - Token � nicht gültig. Token gültig: < > = <> <= !< !> != >= �< �> �= IN IST NICHT WIE ZWISCHEN., SQL state 37000 in SQLExecDirect in F:\xampp\htdocs\php-as400\php-as400.php on line 25
Fehler in SQL

Entfernen aus der Erklärung WÄHLEN Sie die WHERE T§DTDO = 20120319 habe ich es ausgeführt und die Auflistung der Elemente möchte ich mit einer Warnung.

Fatal error: Maximum execution time of 30 seconds exceeded in F:\xampp\htdocs\php-as400\php-as400.php on line 30
T§NDOC  T§DTDO
C008931 19941102
P005027 19950214
P005031 19950320
P005055 19950612
P005062 19950904
P005065 19950920
P005082 19951218
P005157 19970102
P005186 19970428
P005187 19970429
P005190 19970520
I009353 19970721
P005257 19980217 

Zeile 30 ist :

while (odbc_fetch_row($result))

Ich glaube das problem ist das Zeichen §, als ich auf der Suche im internet (https://bugs.php.net/bug.php?id=47133), aber ich weiß nicht, wie es zu lösen.

InformationsquelleAutor stblack | 2012-03-20
Schreibe einen Kommentar