June 23, 2008 at 3:36 pm
Hello,
I have a stored procedure that I want to run from a web page using PHP, I have used odbc_prepare, odbc_execute and odbc_exec functions yet I am not able to get the stored procedure to execute, it is a simple procedure, no parameters, No luck.
Can anyone help me, is this something to do with PHP set up?
Thanks
Ramesh
June 30, 2008 at 10:04 am
I am having the same problem. The only difference is that I am getting an error message in the following statement. My procedure has 1 in parameter.
$sessionid = $a . $b;
$stmt = odbc_prepare($conn, "CALL prc_ProcessAcqTemData(?)");
/* --> ERRORS OUT HERE --> */ $res = odbc_execute($stmt, array($sessionid));
if (!$res){
printf(odbc_error($conn));
die();
}
Error message is:
Warning: odbc_execute() [function.odbc-execute]: SQL error: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error, SQL state 07001 in SQLExecute in D:\asqscript\process_upload_devl.php on line 366
07001
Any comments would be greatly appreciated.
Thanks,
Sinan
June 30, 2008 at 10:36 am
Good news! Right after posting the error message, I fixed the problem. Below is the latest piece of code which works well.
$sessionid = $a . $b;
$stmt = odbc_prepare($conn, "{call prc_ProcessAcqTemData(?)}");
$res = odbc_execute($stmt, array($sessionid));
if (!$res){
printf(odbc_error($conn));
die();
}
October 29, 2008 at 7:37 pm
Hello Ramesh
Here is my code of stored procedure with no parameters
<?php
// create connection
$connection = odbc_connect("test","sa","");
// test connection
if (!$connection) {
echo "Couldn't make a connection!";
exit;
}
// create SQL statement
$sql = "TesttempSP";
// $sql="SELECT * FROM customer
// prepare SQL statement
$sql_result = odbc_prepare($connection,$sql);
// execute SQL statement and get results
odbc_execute($sql_result);
// format result in HTML table
odbc_result_all($sql_result,"border=1");
// free resources and close connection
odbc_free_result($sql_result);
odbc_close($connection);
?>
Thanks...
Donnjonard
October 31, 2008 at 8:39 am
Thanks Everyone for the help, These codes worked
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply