AS400 Iseries ODBC PHP connection

$server=”iseries”; #the name of the iSeries
$user=”myusr”; #a valid username that will connect to the DB
$pass=”mypassword”; #a password for the username

#Connect to the Database with ODBC – $conn is defined and loaded using the “odbc_connect” PHP #directive.
$conn=odbc_connect($server,$user,$pass); #you may have to remove quotes

#Check Connection
if ($conn == false) {
echo “Not able to connect to database…
“;
}

#Query the Database into a result set –

$result=odbc_exec($conn,”SELECT * from a358747.tmfphr01”);

#…do other stuff here…
echo “EMFNAM”;
while (odbc_fetch_row($result))
{
$uptext=odbc_result($result,”EMFNAM”);
echo $uptext;
}

#don’t forget to close the connection when you’re done

odbc_close($conn);
?>