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
LVL 2
jonaleeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.