草庐IT

mysqli_stmt_bind_param

全部标签

php - 将空字符串绑定(bind)到 pdo 准备查询时出现 HY104 Sql 服务器错误

我应该将一个应用程序从mssql函数移动到PDO。一切都运行得很顺利,直到我发现自己遇到了一个我似乎无法解决的小错误。这是我准备好的请求:$req_action="INSERTINTO[".DB_SCHEMA."].[dbo].[".ACTION_TABLE."]([ID_CONTACT],[ID_ADN],[TYPE_ACTION],[MOTIF_ENTRANT],[COMMENTAIRES_APPEL],[CODE_CAMPAGNE],[EMAIL],[SUJET],[STATUT_EMAILING],[DATE_ENVOI],[DELAI_OUVERTURE],[MAIL_CLI

php - mysqli准备好的语句和事务可以一起使用吗?

我想知道的是mysqli的prepare、execute、rollback能不能一起使用?$m=newmysqli($dbhost,$dbuser,$dbpassword,$dbname);$m->autocommit(FALSE);$stmt=$m->prepare("INSERT`table`(`name`,`gender`,`age`)VALUES(?,?,?)");$stmt->bind_param("ssi",$name,$gender,$age);$query_ok=$stmt->execute();$stmt=$m->prepare("INSERT`table`(`nam

php - Laravel 服务容器是否可以绑定(bind)到类及其所有祖先 - 就像在 Symfony 中一样

我有这样的基类:classBaseAPI{publicfunction__construct(Client$client,CacheInterface$cache,$apiBaseUri){$this->client=$client;$this->apiBaseUri=$apiBaseUri;$this->cache=$cache;}}然后在提供者中:classAPIServiceProviderextendsServiceProvider{publicfunctionregister(){$this->app->when(BaseAPI::class)->needs('$apiBas

php - pdo-odbc 不适用于绑定(bind)值,nvarchar 和文本在等于运算符中不兼容

有一列url(nvarchar(200),notnull)setAttribute(PDO::ATTR_PERSISTENT,false);$pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_WARNING);//plainsqlquery:WORKSFINE!$sth=$pdo->prepare("SELECTCOUNT(*)FROMpaginaWHEREurl='/webito'");$sth->execute();//usingbindValue:ERROR!$sth=$pdo->prepare("SELECTCOUNT(*)FRO

php - 检查mysqli查询是否成功的正确方法

我已经阅读了几篇关于此类问题的文章,但是没有一篇对我有帮助,我有点困惑该怎么做。基本上,我想检查执行的sql查询是否没有任何错误。为此,我是否必须使用下面显示的两个if语句?if($stmt=$mysqli->prepare("INSERTINTOtableVALUES(?,?,?);")){$stmt->bind_param("sss",$a,$b,$c);if(!$stmt->execute()){//DoIhavetocatchtheproblemhere?}if($stmt->affected_rows===-1){//DoIhavetocatchtheproblemhere?

php - ldap_bind() 挂起/卡住

所以我将我的问题简化为一个简单的php脚本test.php当我转到localhost\test.php时,浏览器指示它正在等待响应,并且会一直卡在那里......永远(更准确地说,直到我停止它,有时一个小时后,但你明白了)。使用xdebug,我能够将挂起精确定位到ldap_bind()调用。当我尝试跨过或进入ldap_bind()代码行时,我的xdebug挂起并变得没有响应。ldap_set_option(NULL,LDAP_OPT_DEBUG_LEVEL,7);的记录输出是:ldap_createldap_url_parse_ext(domain.com)ldap_bind_slda

php - 检索值 mysqli_fetch

我试图从数据库中名为usuario的表中获取id值,将$username作为参数传递,函数$conexion->connect()返回一个mysqli对象。这些函数没有给我任何错误,但它没有从数据库返回值。我错过了什么吗?或犯任何错误。感谢您的帮助。publicfunctioncheckUserNameExists($username){$conexion=newConnection();$conexion->connect();$query="selectidfromusuariowhereusername=?";$reg=0;$stmt=$conexion->connect()->

PHP后期静态绑定(bind)作用域困惑

来自PHPmannual第二段,它说:static::introducesitsscope.我相应地尝试了以下示例:classFather{publicfunctiontest(){echostatic::$a;}}classSonextendsFather{protectedstatic$a='staticforwardscope';publicfunctiontest(){parent::test();}}$son=newSon();$son->test();//print"staticforwardscope"它按描述工作。但是,以下示例将引发fatalerror:classFa

php - PHP PDO(使用 libpq V 9.1.4)绑定(bind)以使用 CITEXT 的解决方法?

场景运行以下版本的PHP和PostgreSQL的两个系统(不是服务器)软呢帽15:PHPPHP5.3.13(cli)(built:May9201214:38:35)Copyright(c)1997-2012ThePHPGroupZendEnginev2.3.0,Copyright(c)1998-2012ZendTechnologiespdo_pgsqlPostgreSQL(libpq)Version9.0.7Moduleversion1.0.2PostgreSQLPostgreSQL9.1.4WithCITEXTextensionenabled.ArchLinux:PHPPHP5.4.

php - 如何将 Symfony2 表单与数组(不是请求)绑定(bind)?

假设我有一个带有一堆字段的HTML表单。有些字段属于产品,有些属于订单,有些属于其他。提交表单后,我想接受该请求,然后在Controller中为产品、订单和其他创建Symfony表单。然后我想获取部分表单数据并将其与适当的表单绑定(bind)。一个例子是这样的:$productArray=array('name'=>$request->get('name'));$pf=$this->createForm(new\MyBundle\Form\ProductType(),$product);$pf->bind($productArray);if($pf->isValid()){//subm