<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >ifx_prepare</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual PHP" HREF="index.html"><LINK REL="UP" TITLE="Informix Functions" HREF="ref.ifx.html"><LINK REL="PREVIOUS" TITLE="ifx_pconnect" HREF="function.ifx-pconnect.html"><LINK REL="NEXT" TITLE="ifx_query" HREF="function.ifx-query.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-2"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.ifx-pconnect.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.ifx-query.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.ifx-prepare" ></A >ifx_prepare</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN44150" ></A ><P > (PHP 3>= 3.0.4, PHP 4 , PHP 5)</P >ifx_prepare -- Prepare an SQL-statement for execution</DIV ><DIV CLASS="refsect1" ><A NAME="AEN44153" ></A ><H2 >Description</H2 >int <B CLASS="methodname" >ifx_prepare</B > ( string query, int conn_id [, int cursor_def, mixed blobidarray])<BR ></BR ><P > Returns an integer <VAR CLASS="parameter" >result_id</VAR > for use by <A HREF="function.ifx-do.html" ><B CLASS="function" >ifx_do()</B ></A >. Sets <VAR CLASS="parameter" >affected_rows</VAR > for retrieval by the <A HREF="function.ifx-affected-rows.html" ><B CLASS="function" >ifx_affected_rows()</B ></A > function. </P ><P > Prepares <VAR CLASS="parameter" >query</VAR > on connection <VAR CLASS="parameter" >conn_id</VAR >. For "select-type" queries a cursor is declared and opened. The optional <VAR CLASS="parameter" >cursor_type</VAR > parameter allows you to make this a "scroll" and/or "hold" cursor. It's a bitmask and can be either IFX_SCROLL, IFX_HOLD, or both or'ed together. </P ><P > For either query type the estimated number of affected rows is saved for retrieval by <A HREF="function.ifx-affected-rows.html" ><B CLASS="function" >ifx_affected_rows()</B ></A >. </P ><P > If you have BLOB (BYTE or TEXT) columns in the query, you can add a <VAR CLASS="parameter" >blobidarray</VAR > parameter containing the corresponding "blob ids", and you should replace those columns with a "?" in the query text. </P ><P > If the contents of the TEXT (or BYTE) column allow it, you can also use "ifx_textasvarchar(1)" and "ifx_byteasvarchar(1)". This allows you to treat TEXT (or BYTE) columns just as if they were ordinary (but long) VARCHAR columns for select queries, and you don't need to bother with blob id's. </P ><P > With ifx_textasvarchar(0) or ifx_byteasvarchar(0) (the default situation), select queries will return BLOB columns as blob id's (integer value). You can get the value of the blob as a string or file with the blob functions (see below). </P ><P > See also: <A HREF="function.ifx-do.html" ><B CLASS="function" >ifx_do()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.ifx-pconnect.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Acasã</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.ifx-query.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >ifx_pconnect</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.ifx.html" ACCESSKEY="U" >Sus</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >ifx_query</TD ></TR ></TABLE ></DIV ></BODY ></HTML >