note 79058 added to function.odbc-execute

From: Date: Thu, 08 Nov 2007 14:09:12 +0000
Subject: note 79058 added to function.odbc-execute
Groups: php.notes 
Request: Send a blank email to php-notes+get-132113@lists.php.net to get a copy of this message
Obdc_prepare and obdc_execute can only be used as an alternative to odbc_exec in limited circumstances: $con = obdc_connect ($dsn, $user, $pass); $sql = "select * from TABLE"; $result = obdc_exec ($con, $sql); //this line can be replaced as blow //then to see results: odbc_result_all ($result); odbc_free_result ($result); odbc_close ($con); gives the same result with the middle line as: $result = odbc_prepare ($con, $sql); odbc_execute ($result); as long as $sql contains a well formed and complete query. There is no point in trying to convert this into a parameter query with question marks as placeholders, since code like this will result only in error messages: $sql = "select * from TABLE where needle = ?"; $result = odbc_prepare ($con, $sql); for ($i = 0; $i < 4; $i++) { odbc_execute ($result, array ($i)); // and whatever you want to do with the result // but all you get is "parameter expected" or "count does not match" } The lack of documentation for such functions should have been an alarm signal. ---- Server IP: 69.147.83.197 Probable Submitter: 130.75.198.156 ---- Manual Page -- http://www.php.net/manual/en/function.odbc-execute.php Edit -- https://master.php.net/note/edit/79058 Del: integrated -- https://master.php.net/note/delete/79058/integrated Del: useless -- https://master.php.net/note/delete/79058/useless Del: bad code -- https://master.php.net/note/delete/79058/bad+code Del: spam -- https://master.php.net/note/delete/79058/spam Del: non-english -- https://master.php.net/note/delete/79058/non-english Del: in docs -- https://master.php.net/note/delete/79058/in+docs Del: other reasons-- https://master.php.net/note/delete/79058 Reject -- https://master.php.net/note/reject/79058 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132113) next »