PHP - Execute a delete using a parameter

From Ingres Community Wiki

Jump to: navigation, search
<?php
$database='dbname';
$user='user';
$password='password';


$conn = ingres_connect($database,$user,$password);

if (is_resource($conn)) {
    echo "Connection succeeded.";
    $param = array(1,1.1,"Row 1");
        $rc_insert=ingres_query($conn,"insert into param_tests values (?,?,?)",$param);
        if (is_resource($rc_insert)) {
                echo "Insert succeeded.";
                $param = array(1);
                $rc_select=ingres_query($conn,"select * from param_tests where col1 = ?",$param);
                if (is_resource($rc_select)) {
                        while ( $object = ingres_fetch_object($rc_select)) {
                                echo $object->col1 . " " . $object->col2 . " " . $object->col3 .".";
                        }

                        $rc=ingres_query($conn,"delete from param_tests where col1 = ?",$param);

                        if (ingres_errno() != 0)
                        {
                                echo "Delete failed.";
                        }
                        else
                        {
                                echo "Delete succeeded.";
                        }
                }

        } else {
                echo "Insert failed.";
        }
    ingres_close($conn);
} else {
    echo "Connection failed.";
}

?>

Back to PHP Driver Examples

Personal tools
Developing With