• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 833
  • Last Modified:

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
0
jonalee
Asked:
jonalee
1 Solution
 
oubelkasCommented:
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
0
 
jonaleeAuthor Commented:
Stored Procedure is a SQL-Server script that run by the SQL server itself. It offer more scure, fater and Transaction function.
0
 
logan69Commented:
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.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
jonaleeAuthor Commented:
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.


 


0
 
oubelkasCommented:
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
0
 
oubelkasCommented:
You might wanna try this :

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

Joseph
0
 
oubelkasCommented:
Have you tried it yet?
0
 
jonaleeAuthor Commented:
I want to transfer the parameter
0
 
merronysCommented:
We do this all the time here.

eg. calling an SP with a date parameter:

$qry = "BusDaysInYear '$wrking_date'";
$rc = sybase_query( $qry, $hDB );
....
then get the results just like any query.

Remember to use normal rules for quotes around non-numeric parameters.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now