Answers

Question and Answer:

  Home  MS SQL Server

⟩ How To Create Prepared Statements using odbc_prepare()?

If you have a SQL statement that need to executed repeatedly many times with small changes, you can create a prepared statement object with parameters so it can be executed more efficiently.

There are two functions you need to use prepare and execute a prepared statement object:

$statement_object = odbc_prepare($connection,

$statement_string);

#- The $statement_string may have parameters represented

#- by "?".

$result_set = odbc_execute($statement_object $array);

#- The $array is used to supply values to parameters

#- defined in the statement object.

The tutorial PHP script below shows you how to insert 3 rows into a table with a prepared statement object with 2 parameters:

 132 views

More Questions for you: