本文介绍了mssql_bind没有发布数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 请帮忙,我正在研究一个项目,这不是将数据发布到sql 它发布的所有数据都没问题,除了 mdo 数据 mssql_bind($ stmt,' @ mdo',$ mdo,SQLVARCHAR, false,false,3); 下面的PHP代码 $ stmt = mssql_init( sp_InsertOffenderAndUpdateCaseNewAuto); //是原始的 // set params for 商店 Proc 罪犯传递信息来自第2页当 用户后退箭头 mssql_bind( $ stmt ,' @ offenderForename', $ offenderforename ,SQLVARCHAR,false,false, 255 ); mssql_bind( $ stmt ,' @ offenderSurname ', $ offendersurname ,SQLVARCHAR,false,false, 255 ); mssql_bind( $ stmt ,' @ offenderCRN ', $ offendercrn ,SQLVARCHAR,false,false, 50 ); mssql_bind( $ stmt ,' @ offenderDOB ', $ offenderdob ,SQLVARCHAR,false,false, 10 ); // mssql_bind( $ stmt ,' @offenderOffenses', $ offenses ,SQLVARCHAR,false,false, 255 ); mssql_bind( $ stmt ,' @ offenderPrisonNumber ', $ prisonnumber1 ,SQLVARCHAR,false,false, 255 ); mssql_bind( $ stmt ,' @ offenderPrisonLocation ', $ prisonlocation ,SQLVARCHAR,false,false, 255 ); // 下面的行是使用的 添加数据到 数据库电话号码 for OM manager mssql_bind( $ stmt ,' @ offenderTelNo', $ telephoneno ,SQLVARCHAR,false,false, 30 ); //设置params 商店 Proc for 更新案例信息传递信息来自第二页当 用户后退箭头 mssql_bind( $ stmt , 3 ); mssql_bind( $ stmt ,' @ sentensedate ', $ sentensedate ,SQLVARCHAR,false,false, 255 ); mssql_bind( $ stmt ,' @ court ', $ court ,SQLVARCHAR,false,false, 255 ); mssql_bind( $ stmt ,' @ sentense ', $ sentense ,SQLVARCHAR,false,false, 255 ); mssql_bind( $ stmt ,' @ remand ', $ remand ,SQLVARCHAR,false,false, 255 ); mssql_bind( $ stmt ,' @ offendermanager ', $ offendermanager ,SQLVARCHAR,false,false, 255 ); mssql_bind( $ stmt ,' @ location ', $ location ,SQLVARCHAR,false,false, 255 ); mssql_bind( $ stmt ,' @ dateofsentense ', $ dateofsentense ,SQLVARCHAR,false,false, 255 ); mssql_bind( $ stmt ,' @ hdc ', $ hdc ,SQLVARCHAR,false,false, 10 ); mssql_bind( $ stmt ,' @ ard ', $ ard ,SQLVARCHAR,false,false, 10 ); mssql_bind( $ stmt ,' @ led ', $ led ,SQLVARCHAR,false,false, 10 ); mssql_bind( $ stmt ,' @ sed ', $ sed ,SQLVARCHAR,false,false, 10 ); mssql_bind( $ stmt ,' @ hospitalorder ', $ hospitalorder ,SQLVARCHAR,false,false, 255 ); mssql_bind( $ stmt ,' @ referral ', $ referral ,SQLVARCHAR,false,false, 255 ); mssql_bind( $ stmt ,' @ id ', $ vrecid ,SQLINT4,false,false, 10 ); mssql_bind( $ stmt ,' @ offenderid ', $ offenderid ,SQLINT4,true,false, 10 ); $ tmp = mssql_execute( $ stmt ); 存储程序: USE [VictimDBJHv2] GO / ******对象:StoredProcedure [dbo ]。[sp_UpdateOffender]脚本日期:06/10/2013 22:47:49 ****** / SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROC [dbo]。[sp_UpdateOffender] @offenderForename as varchar(255)= null, @offenderSurname as varchar(255)= null, @offenderCRN as varchar(50 )= null, @offenderDob as varchar(255)= null, @offenderPrisonNumber as varchar(255)= null, @offenderPrisonLocation as varchar(255)= null, @offenderTelNo as varchar(30)= null, @mdo varchar(3)= null, @id int, @offenderid int OUTPUT as UPDATE Offender SET offenderForename = @ offenderForename,offenderSurname = @ offenderSurname, offenderCRN = @ offenderCRN, offenderDob = convert(datetime,@ offenderDob,103), offenderPrisonNumber = @ offenderPrisonNumber, offenderPrisonLocation = @ offenderPrisonLocation,offenderTelNo = @ offenderTelNo,mdo = @ mdo where offenderid in(从offendercase选择oc.offenderid为oc,maincase为m,offender为o,其中m.id = @id和 m.id = oc.caseid和o.offenderid = oc.offenderid和oc.firstoffender = 1 ) SET @offenderid =(从offendercase选择oc.offenderid为oc,maincase为m, offender为o,其中m.id = @ id和 m.id = oc.caseid和o.offenderid = oc.offenderid和oc.firstoffender = 1) 返回@offenderid ============================ = 第二存储程序 USE [VictimDBJHv2] GO / ******对象:StoredProcedure [dbo]。[sp_InsertOffenderAndUpdateCaseNewAuto]脚本日期:06/10/2013 21:32:58 ****** / SET ANSI_NULLS ON GO SET QU OTED_IDENTIFIER ON GO ALTER PROC [dbo]。[sp_InsertOffenderAndUpdateCaseNewAuto] @offenderForename as varchar(255)= null, @offenderSurname as varchar(255)= null, @offenderCRN as varchar(50)= null, @offenderDob as varchar(255)= null, @offenderPrisonNumber as varchar(255)= null, @offenderPrisonLocation as varchar(255)= null, @offenderTelNo as varchar(30)= null, @mdo as varchar(3)= null, @sentensedate varchar(255)= null, @court varchar(255)= null, @sentense varchar(255)= null, @remand varchar(255)= null, @offendermanager varchar(255)= null , @location varchar(255)= null, @dateofsentense varchar(255)= null, @hdc varchar(255)= null, @ard varchar(255) = null, @led varchar(255)= null, @sed varchar(255)= null, @hospitalorder varchar(255)= null, @referral varchar( 255)= null, @id int, @offenderid int输出 as --declare @offenderid as i nt --declare @caseid as int BEGIN TRANSACTION Tran1 BEGIN exec sp_UpdateOffender @ offenderForename,@ offenderSurname,@ offenderCRN,@ offenderDob,@ offenderPrisonNumber,@ offenderPrisonLocation,@ offenderTelNo,@ mdo,@ id,@ offenderid OUTPUT exec sp_UpdateCaseNew @ sentensedate,@ court,@ sentense,@ remand,@ offendermanager,@ location,@ dateofsentense,@ hdc,@ ard ,@ led,@ sed,@ hospitalorder,@ referral,@ offenderPrisonNumber,@ offenderPrisonLocation,@ id exec sp_InsertTargetContactDate @ sentensedate,@ id --exec sp_InsertOffenderCase @offenderid,@ id 结束 IF @@ ERROR = 0 BEGIN COMMIT 返回@offenderid 结束 ELSE BEGIN ROLLBACK TRANSACTION Tran1 END 解决方案 stmt,' @ mdo', mdo,SQLVARCHAR,false,false,3); 以下PHP代码 stmt = mssql_init( sp_InsertOffenderAndUpdateCaseNewAuto); //是原始的 // set params Store Proc for 罪犯传递信息来自第二页当 用户后退箭头 mssql_bind( please help, I am working on a project and this is not posting the data to the sqlits posting all the data ok except from the mdo datamssql_bind($stmt, '@mdo', $mdo, SQLVARCHAR,false,false,3);PHP Code below$stmt= mssql_init("sp_InsertOffenderAndUpdateCaseNewAuto");// was the original //set params for Store Proc for offender passed information from 2nd page when user pressed back arrow mssql_bind($stmt, '@offenderForename', $offenderforename, SQLVARCHAR,false,false,255); mssql_bind($stmt, '@offenderSurname', $offendersurname, SQLVARCHAR,false,false,255); mssql_bind($stmt, '@offenderCRN', $offendercrn, SQLVARCHAR,false,false,50); mssql_bind($stmt, '@offenderDOB', $offenderdob, SQLVARCHAR,false,false,10); //mssql_bind($stmt, '@offenderOffenses', $offenses, SQLVARCHAR,false,false,255); mssql_bind($stmt, '@offenderPrisonNumber', $prisonnumber1, SQLVARCHAR,false,false,255); mssql_bind($stmt, '@offenderPrisonLocation', $prisonlocation, SQLVARCHAR,false,false,255); //the line below is the one used to add data to database tel number for OM manager mssql_bind($stmt, '@offenderTelNo', $telephoneno, SQLVARCHAR,false,false,30); //set params for Store Proc for updated case info passed information from 2nd page when user pressed back arrow mssql_bind($stmt, '@mdo', $mdo, SQLVARCHAR,false,false,3); mssql_bind($stmt, '@sentensedate', $sentensedate, SQLVARCHAR,false,false,255); mssql_bind($stmt, '@court', $court, SQLVARCHAR,false,false,255); mssql_bind($stmt, '@sentense', $sentense, SQLVARCHAR,false,false,255); mssql_bind($stmt, '@remand', $remand, SQLVARCHAR,false,false,255); mssql_bind($stmt, '@offendermanager', $offendermanager, SQLVARCHAR,false,false,255); mssql_bind($stmt, '@location', $location, SQLVARCHAR,false,false,255); mssql_bind($stmt, '@dateofsentense', $dateofsentense, SQLVARCHAR,false,false,255); mssql_bind($stmt, '@hdc', $hdc, SQLVARCHAR,false,false,10); mssql_bind($stmt, '@ard', $ard, SQLVARCHAR,false,false,10); mssql_bind($stmt, '@led', $led, SQLVARCHAR,false,false,10); mssql_bind($stmt, '@sed', $sed, SQLVARCHAR,false,false,10); mssql_bind($stmt, '@hospitalorder', $hospitalorder, SQLVARCHAR,false,false,255); mssql_bind($stmt, '@referral', $referral, SQLVARCHAR,false,false,255); mssql_bind($stmt, '@id', $vrecid, SQLINT4,false,false,10); mssql_bind($stmt, '@offenderid', $offenderid, SQLINT4,true,false,10); $tmp=mssql_execute($stmt);Stored procedures:USE [VictimDBJHv2]GO/****** Object: StoredProcedure [dbo].[sp_UpdateOffender] Script Date: 06/10/2013 22:47:49 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER PROC [dbo].[sp_UpdateOffender]@offenderForename as varchar(255) = null,@offenderSurname as varchar(255) = null,@offenderCRN as varchar(50) = null,@offenderDob as varchar(255) = null,@offenderPrisonNumber as varchar(255) = null,@offenderPrisonLocation as varchar(255) = null,@offenderTelNo as varchar(30) = null,@mdo varchar(3) = null,@id int,@offenderid int OUTPUTasUPDATE Offender SET offenderForename=@offenderForename, offenderSurname=@offenderSurname,offenderCRN=@offenderCRN, offenderDob=convert(datetime,@offenderDob,103),offenderPrisonNumber=@offenderPrisonNumber,offenderPrisonLocation=@offenderPrisonLocation, offenderTelNo=@offenderTelNo,mdo=@mdowhere offenderid in (select oc.offenderid from offendercase as oc, maincase as m, offender as o where m.id=@id andm.id=oc.caseid and o.offenderid=oc.offenderid and oc.firstoffender = 1)SET @offenderid = (select oc.offenderid from offendercase as oc, maincase as m, offender as o where m.id=@id andm.id=oc.caseid and o.offenderid=oc.offenderid and oc.firstoffender = 1)return @offenderid=============================2nd stored procedureUSE [VictimDBJHv2]GO/****** Object: StoredProcedure [dbo].[sp_InsertOffenderAndUpdateCaseNewAuto] Script Date: 06/10/2013 21:32:58 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER PROC [dbo].[sp_InsertOffenderAndUpdateCaseNewAuto]@offenderForename as varchar(255) = null,@offenderSurname as varchar(255) = null,@offenderCRN as varchar(50) = null,@offenderDob as varchar(255) = null,@offenderPrisonNumber as varchar(255) = null,@offenderPrisonLocation as varchar(255) = null,@offenderTelNo as varchar(30) = null,@mdo as varchar(3) = null,@sentensedate varchar(255) = null,@court varchar(255) = null,@sentense varchar(255) = null,@remand varchar(255) = null,@offendermanager varchar(255) = null,@location varchar(255) = null,@dateofsentense varchar(255) = null,@hdc varchar(255) = null,@ard varchar(255) = null,@led varchar(255) = null,@sed varchar(255) = null,@hospitalorder varchar(255) = null,@referral varchar(255) = null,@id int,@offenderid int outputas--declare @offenderid as int--declare @caseid as intBEGIN TRANSACTION Tran1BEGINexec sp_UpdateOffender @offenderForename,@offenderSurname,@offenderCRN,@offenderDob,@offenderPrisonNumber,@offenderPrisonLocation,@offenderTelNo,@mdo,@id, @offenderid OUTPUTexec sp_UpdateCaseNew @sentensedate,@court,@sentense,@remand,@offendermanager,@location,@dateofsentense,@hdc,@ard,@led,@sed,@hospitalorder,@referral,@offenderPrisonNumber,@offenderPrisonLocation,@idexec sp_InsertTargetContactDate @sentensedate,@id--exec sp_InsertOffenderCase @offenderid, @idENDIF @@ERROR = 0BEGINCOMMIT return @offenderidENDELSEBEGINROLLBACK TRANSACTION Tran1END 解决方案 stmt, '@mdo',mdo, SQLVARCHAR,false,false,3);PHP Code belowstmt= mssql_init("sp_InsertOffenderAndUpdateCaseNewAuto");// was the original //set params for Store Proc for offender passed information from 2nd page when user pressed back arrow mssql_bind( 这篇关于mssql_bind没有发布数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-31 20:13