note 911 modified in function.odbc-execute by yannick

From: Date: Fri, 25 Jul 2008 16:51:31 +0000
Subject: note 911 modified in function.odbc-execute by yannick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142701@lists.php.net to get a copy of this message
For a simple database insert to a database that has no password and $from and $to are predefined variables. <?php /* get connection */ $conn=odbc_connect("mydb","",""); /* run insert */ $stmt = odbc_prepare($conn, "INSERT INTO mytable (jor_from, jor_to) VALUES('$from', '$to');" ); /* check for errors */ if (!odbc_execute($stmt)) { /* error */ echo "Whoops"; } /* close connection */ odbc_close($conn); ?> --was-- For a simple database insert to a database that has no password and $from and $to are predefined variables. /* get connection */ $conn=odbc_connect("mydb","",""); /* run insert */ $stmt = odbc_prepare($conn, "INSERT INTO mytable (jor_from, jor_to) VALUES('$from', '$to');" ); /* check for errors */ if (!odbc_execute($stmt)) { /* error */ echo "Whoops"; } /* close connection */ odbc_close($conn); http://php.net/manual/en/function.odbc-execute.php

« previous php.notes (#142701) next »