note 72418 added to function.mssql-execute
| From: | MandaKrishnaSrikanth at osu1 dot php dot net | Date: | Thu, 18 Jan 2007 04:56:02 +0000 |
| Subject: | note 72418 added to function.mssql-execute | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-121872@lists.php.net to get a copy of this message | ||
While using stored procedures on SQL EXPRESS (and perhaps on SQL Server), you have to specify the
column names in SELECT, instead of asterisk (*). Or else you will get some big Unicode error.
That is, instead of "select * from table",
use "select col1, col2 from table".
One more important thing, Before using mssql_execute, you MUST AND SHOULD use mssql_init. mssql_init
will generate the MS Sql statement resource, which will be taken as input by mssql_execute. Here is
an example,
<?php
if($conn = mssql_connect('localhost\SQLEXPRESS', 'krishna',
'srikanth')) echo 'Connected to SQLEXPRESS';
if(mssql_select_db("Northwind",$conn)) echo 'Selected DB: Northwind<BR>';
$sql_statement = mssql_init("[Ten Most Expensive Products]", $conn);
$result=mssql_execute($sql_statement);
while ($row = mssql_fetch_assoc($result))
print_r($row);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 203.145.145.10 (proxied: 172.19.48.201)
----
Manual Page -- http://www.php.net/manual/en/function.mssql-execute.php
Edit -- https://master.php.net/note/edit/72418
Del: integrated -- https://master.php.net/note/delete/72418/integrated
Del: useless -- https://master.php.net/note/delete/72418/useless
Del: bad code -- https://master.php.net/note/delete/72418/bad+code
Del: spam -- https://master.php.net/note/delete/72418/spam
Del: non-english -- https://master.php.net/note/delete/72418/non-english
Del: in docs -- https://master.php.net/note/delete/72418/in+docs
Del: other reasons-- https://master.php.net/note/delete/72418
Reject -- https://master.php.net/note/reject/72418
Search -- https://master.php.net/manage/user-notes.php