Utterly Baffled : mssql stored procedure

wxdqz

New Member
hi there,

i'm utterly baffled as to how to get a stored procedure to function under php4 on a windows2000/apache box.

i'm connecting to the db succesfully, however any attempts to execute a stroed procedure fail. any ideas.

i have tried several approaches:

$conn=mssql_connect("server","un","pwd");
mssql_select_db("dbname",$conn);

//various sp sql attempts...

$sql = "sp_addMessage $fromid, $toid, '$message', '".date("m/d/Y H:i:s")."', '07/20/2001 17:36:21', ".$distribution."";
$sql = "{ call sp_addMessage ($fromid, $toid, '$message', '".date("m/d/Y H:i:s")."', '14/06/2001 17:36:21', ".$distribution.") }";
$sql = "{ exec sp_addMessage ($fromid, $toid, '$message', '".date("m/d/Y H:i:s")."', '14/06/2001 17:36:21', ".$distribution.") }";
$sql = "exec sp_addMessage $fromid, $toid, '$message', '".date("m/d/Y H:i:s")."', '14/06/2001 17:36:21', ".$distribution."";

$result=mssql_query($sql,$conn);
if ($result==FALSE) echo "$sql : ".mssql_get_last_message();

the stored procedure is a INSERT statement, therefore variable $result is assigned FALSE.

the sp doesn't appear to error, but still doesn't execute. any suggestions would help me sleep tonight :)

thanks in advance
Craig
 
Back
Top