Link to home
Start Free TrialLog in
Avatar of jonalee
jonalee

asked on

Call Sybase Store Procedure from PHP

Hello, I'm using PHP3.
I have installed the Sybase PHP3 support.

The question is how can I call the Store Procedure in Sybase using PHP.
Please give the sample
Avatar of oubelkas
oubelkas

well, I'm not that experienced with sybase, so could you explain why you would use the Store procedure using PHP, for PHP can store your queries in your database.

Joseph
Avatar of jonalee

ASKER

Stored Procedure is a SQL-Server script that run by the SQL server itself. It offer more scure, fater and Transaction function.
This should work if you tweak it about to suit your machine.
<?PHP
$sybase = sybase_connect();
sybase_dbuse("<Datebase Name>", $sybase);
$result = sybase_query("INSERT INTO temp etc...");

This should write the values into the table.
Avatar of jonalee

ASKER

Hey, I mean how to call Sybase Stored-Procedure using PHP's sybase function.
Your answer is just submit the SQL query.

The stored procedure I created in Sybase database like using the following line:
Create Procedure mmm
  @number int,
  @name varchar(50)
As
  BEGIN TRANSACTION 'trans1'
  INSERT INTO people (id,name) VALUES(@number,@name)

  COMMIT TRANSACTION 'trans1'



The question is how to call the function mmm in PHP's sybase function.


 


I'm not sure if this is possible, the functions which are available in PHP for sybase don't include something like sybase_call_procedure. Still I'll look for it.

Joseph
You might wanna try this :

$result = sybase_sql("EXEC mmmm");
$arr = sybase_fetch_row($result);

Joseph
Have you tried it yet?
Avatar of jonalee

ASKER

I want to transfer the parameter
ASKER CERTIFIED SOLUTION
Avatar of merronys
merronys

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial