fhiiqm/test/stmt.php
author Bettina Schwarzer <schwarzer@fhi-berlin.mpg.de>
Wed, 31 Aug 2011 14:22:19 +0200
changeset 1 6288d5685bff
permissions -rw-r--r--
Stand v. 31.08.2011

<?php

/**
 * @author Bettina Schwarzer
 * @copyright 2011
 *
 * TEST mit stmt-Klasse mysqli
 */

    include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
	$dbc = new dbconnection();
    
    echo "TEST mit stmt-Klasse mysqli<br />\n";
    
    $stmt = $dbc -> stmtinit(); // jetzt wird das $stmt-Objekt erstellt
    
    if (is_object($stmt))
    {
        $stmt -> prepare ("SELECT * FROM Vertrag WHERE contract_ID < ? ");
        $stmt -> bind_param('i',$id);
        $id=12;
        $stmt -> execute();
        $stmt -> store_result();
        $stmt -> bind_result($c_ID, $cname, $cs, $cl, $vtyp_ID, $cbegin, $cend, $cmon, $cfile, $cbem);
        
        if ($anz = $stmt -> num_rows)
        {
            echo "$anz Verträge gefunden<br />\n";
            echo "<table>\n";
            while ($stmt -> fetch())
            {
                echo "<tr><td>$c_ID</td>
                        <td>$cname</td>
                        <td>$cl</td>
                        <td>$vtyp_ID</td>
                        <td>$cbegin</td>
                        <td>$cend</td>
                        <td>$cmon</td>
                        <td>$cfile</td>
                        <td>$cbem</td></tr>\n";            
            }
            echo "</table>\n";
        }
    $stmt -> close();
    }

?>