Hy, i have little procedure for update some row when is activate:
USE [Ranking]
GO
/****** Object: StoredProcedure [dbo].[TT_DuelScore] Script Date: 06/30/2013 08:31:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[TT_DuelScore]
@ServerCode INT,
@AccountID VARCHAR(10),
@Name VARCHAR(10),
@Result INT,
@Average INT
As
Begin
BEGIN TRANSACTION
SET NOCOUNT ON

IF EXISTS (SELECT NULL FROM DUEL_INFO WHERE Account = @AccountID AND Name = @Name AND ServerCode = @ServerCode)
IF(@Result = 1)
UPDATE DUEL_INFO SET Win = Win+1, Average = Average + @Average WHERE Account = @AccountID AND Name = @Name AND ServerCode = @ServerCode
ELSE
UPDATE DUEL_INFO SET Lost = Lost+1, Average = Average + @Average WHERE Account = @AccountID AND Name = @Name AND ServerCode = @ServerCode
ELSE
IF(@Result = 1)
UPDATE MuOnline.dbo.Character SET reputation = reputation+1 WHERE AccountID = @AccountID AND Name = @Name
ELSE
IF(@Result = 1)
INSERT INTO DUEL_INFO (ServerCode, Account, Name, Win, Lost, Average) VALUES (@ServerCode,@AccountID,@Name,1,0,@Average)
ELSE
INSERT INTO DUEL_INFO (ServerCode, Account, Name, Win, Lost, Average) VALUES (@ServerCode,@AccountID,@Name,0,1,@Average)

IF(@@Error <> 0 )
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION

SET NOCOUNT OFF
End
but i want to insert new line with new update row , but new row is form oterh table :
- in PHP code for update that row is :
$guildname=mssql_fetch_array(mssql_query("SELECT G_Name FROM MuOnline.dbo.GuildMember WHERE Name='$char'"));
$g_update = mssql_query("Update MuOnline.dbo.Guild set [G_Score]=G_Score+1 where G_Name='$guildname[G_Name]'");
Now who have ideea how to insert this php script in my store procedure?