hi i'm rizki. can you all help me? please
i have a problem with script php to call procedure using sql server database this is the store procedure in sql server: -
CREATE Procedure dbo.q_putaka
-
(
-
@key varchar(200),
-
@scope varchar(4) = null
-
-
)
-
As
-
if @scope ='1'
-
execute ('select distinct author_name,book_id,remark,availability,title from v_pustaka where '+@key +' and DOC_TYPE IN (SELECT NM_TYPE FROM TAKA.R_TYPEDOC WHERE CONVERT(INT,KD_TYPE) <=3 AND CONVERT(INT,KD_TYPE)>=1) ')
-
-
else
-
if @scope='2'
-
execute ('select distinct author_name,book_id,remark,availability,title from v_pustaka where '+@key +' and DOC_TYPE IN (SELECT NM_TYPE FROM TAKA.R_TYPEDOC WHERE CONVERT(INT,KD_TYPE) <=6 AND CONVERT(INT,KD_TYPE)>=4) ')
-
else
-
if @scope='12'
-
execute ('select distinct author_name,book_id,remark,availability,title from v_pustaka where '+@key +' and DOC_TYPE IN (SELECT NM_TYPE FROM TAKA.R_TYPEDOC) ')
-
-
else
-
if @scope='123'
-
execute ('select distinct author_name, book_id,remark,availability,title from v_pustaka where '+@key +' and DOC_TYPE IN (SELECT NM_TYPE FROM TAKA.R_TYPEDOC ) union select convert(varchar,0),book_id,remark,availability,title from v_magazine where '+@key)
-
else
-
select distinct author_name, book_id,remark,availability,title from v_pustaka
-
-
GO
-
n the problem is how to make the script php to call that store procedure?please help me n can you all tell me step by step cause i'm not familiar with script php using sql server database. thanks
4 8330
Have a look at this: http://dev.mysql.com/doc/refman/5.0/en/call.html
Personally I stay away from SP's as experience shows me that merging business layer and data layer causes problems further down the line. I would always keep code and data separate.
Have you thought about PHP objects?
nathj
Try. mssql_bind() Example
[PHP]<?php
$cn = mssql_connect($DBSERVER, $DBUSER, $DBPASS);
mssql_select_db($DB, $cn);
$sp = mssql_init("WDumpAdd"); // stored proc name
mssql_bind($sp, "@productname", stripslashes($newproduct), SQLVARCHAR, false, false, 150);
mssql_bind($sp, "@quantity", stripslashes($newquantity), SQLVARCHAR, false, false, 50);
mssql_execute($sp);
mssql_close($cn);
?>
[/PHP]
See Also mssql_bind() .....
mssql_execute()
mssql_free_statement()
Hi I have this SP to execute at php but I have no Idea how to do it
this is the way I execute it on MSSQL - DECLARE @TranID int
-
BEGIN TRANSACTION
-
EXEC sp_TransactionModify @TranID output, 1, 100.00, 0, 100.00, 123, 456, “2008-08-20”
-
COMMIT
-
SELECT @TranID as TransactionID
How can I do to make it work at php??
Thank you so much!!!!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: jrefactors |
last post by:
I want to know the differences between SQL Server 2000 stored
procedures and oracle stored procedures? Do they have different
syntax? The concept should be the same that the stored procedures...
|
by: sollento |
last post by:
Hi,
How can I export SQL Server Stored Procedures to MS-Access?
Cheers
H
|
by: Borr |
last post by:
Hi,
I have an ASP .NET page, that runs client side timer that
does something on the Server side and after that loads
another page. So I have on client side something like :
function...
|
by: lanem |
last post by:
I want to call a server-side function, like a button's click event, from a
client-side JavaScript function. How do I do that? Thanks.
|
by: karen |
last post by:
Hi all :
this is going to be a long post. So i apologize in
advance :)
i am converting a java program in VB right now. I am a
java programmer by trade. so i am no expert in this
department.
I...
|
by: Radhakrishnans |
last post by:
hai friends
i am new to java and mysql.i have created stored procedures in mysql.Now i want to call that stored procedures in java.All works fine.but it show the following error.
unreported...
|
by: Problematic coder |
last post by:
I have a form based application that inputs values into various oracle
tables, after it has done this I want to call a stored proceedure in
Oracle which is already written to do more work on this...
|
by: Genken |
last post by:
How would i convert or write a simple or complex access query to sql server stored procedures i will include my most complex query i hope somebody can help.
Thankyou in advance.
SELECT...
|
by: Ketki |
last post by:
Hello Friends,
To know how to call Server Side function from Client Side Code using
PageMethods in ASP.NET AJAX, visit:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=109
Regards,
Ketki
|
by: Simon |
last post by:
I heard that we could do that by using AJAX. Could anybody share how to do
it? Thanks.
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |