<!DOCTYPE  HTML  PUBLIC  "-//W3C//DTD  HTML  4.0  Transitional//EN"  "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
  <TITLE>DBMS example 3</TITLE>
<link href="/styles/cs1.css" rel="stylesheet">

</HEAD>
<BODY>
<h1>Simple Query</h1>
This script (see <a href="dbdemo3.phps">source</a>) uses a slightly fancier query to rename the table headings.

<P>
<?php
    
//we don't need a username & password when tables are accessible to web
    
    
$user="";
    
$upasswd="";
    
$dsn "DBMS";  // $dsn is the name of the db2 database


    
$columns 'ven_code as "Vendor Code", ven_name as "Vendor Name", ven_contact_name as "Contact Person", ven_address as "Address"';
    
$query "select $columns from CIS3311.VENDOR order by VEN_CODE";
    print 
"<p>query is: <code>$query</code><br>";
    
//connect 
   
    
$conn = @odbc_pconnect($dsn$user,$upasswd ); 
    if (!
$conn) { 
        print 
"</html>";
        exit;
    }
       

     if (
$result odbc_Exec($conn$query)) {
        print 
"Query returned : " odbc_num_rows($result) . " rows";
        
odbc_result_all($result,'border=2  ');
     }
    
?>

<HR>


<P ALIGN=center>
<A HREF="dbdemo2.phtml">dbdemo2</A> | <A HREF="demos.phtml">demos</A> | <A HREF="dbdemo4.phtml">dbdemo4</A></P>

</BODY></HTML>