草庐IT

mysqli_stmt_bind_param

全部标签

php - 如何实现 Laravel 4 分部 View - 将数据绑定(bind)到分部 View

我正在考虑是否应该使用Laravel来建立一个在线商店。要求-在侧边栏显示购物车,在主区域显示产品列表。我需要将数据绑定(bind)到我的局部View。我创建了一个PartialController来显示部分View。classPartialControllerextendsBaseController{publicfunctionshowCartSummary(){$cartItems=Cart::all();returnView::make('partials.cartsummary',array('cart'=>$cartItems,));}publicfunctionshowP

php - while ($stmt->fetch()) 不获取所有行

我正在尝试使用while循环显示属于已登录用户的所有食谱。我注意到假设用户有4个食谱,第一个不会显示,导致表格中只出现3个食谱。如果用户有3个菜谱,第一个菜谱不会显示,导致只显示2个菜谱,以此类推。我做了我的研究,发现这是因为第一行将被忽略,因此不会显示。有没有人可以建议我应该对循环进行什么样的更正来解决这个问题?我的代码涉及在表格中显示,这就是为什么我仍然无法弄清楚尽管看了看应该做什么在已经发布和回答的其他问题上。非常感谢!prepare("Selectrecipename,recipeid,imagefilefromrecipewhereuserid=?");//3:Bindthe

php - 为什么 mysqli left join 返回 1 行?

我有2个表:1)products2)product_images,它的数据是这样的:productstable:==============ProductIDTitlemodel_number-----------------------------------1title11232title21243title31254title41265title5127product_images==============pi_idp_idproduct_image------------------------------11image122image233image344image451i

php - 如何在 mysqli 中运行选择查询

这个问题在这里已经有了答案:Howtousemysqli_query()inPHP?(1个回答)关闭去年。我需要显示特定的记录,记录存在于数据库中,但它什么也没显示。这是我的代码。$con=mysqli_connect("localhost","root","","test")ordie("ConnectingtoMySQLfailed");$name=$_POST['uname'];$query="SELECT*FROMofficedbWHEREname='.$name.'";$data=mysqli_query($con,$query);while($row=mysqli_fetc

php - 使用 php 单例的几个 mysqli 查询

我有一个非常常用的mysqli类来为应用程序的其余部分提供数据库连接:classIabDBextendsmysqli{privatestatic$instance=null;//dbconnectionconfigvarsprivate$user="xxx-lit";private$pass="xxx";private$dbName="xxx";private$dbHost="xxx";privatefunction__construct(){parent::__construct($this->dbHost,$this->user,$this->pass,$this->dbName)

php - 交响乐 2.8 : How to dynamically set database params based on the hostname

我有100个三级域都指向同一个服务器,我有一个Symfony2.8项目。我需要Symfony能够连接到不同的数据库,具体取决于三级域。我知道我可以创建任意多的环境,但环境的语法更像是:-domainname.com/app_customer1.php/[..]-domainname.com/app_customer2.php/[..]-domainname.com/app_customer3.php/[..]White我想要这个URL结构:-customer1.domainname.com/[..]-customer2.domainname.com/[..]-customer3.dom

php - 在 (php-fpm) docker 容器中找不到 mysqli

我在跑php:7-fpm在我的nginxWeb服务器使用的docker容器中。除了我试图在我的PHP代码中实例化mysqli连接时,一切都运行良好。我收到以下错误:"NOTICE:PHPmessage:PHPFatalerror:UncaughtError:Class'Listener\mysqli'notfoundinindex.php:104这是我用于构建图像的Dockerfile,我在其中明确安装了mysqli扩展:FROMphp:7-fpmRUNdocker-php-ext-installmysqli根据下面的phpinfo()输出,它似乎已安装。我是否需要以某种方式配置或启用

php - 执行 mysqli_query 有效,但它不会返回 WHERE CLAUSE 中给出的确切行

查询执行..但假设用户更改了$_GET['sub']的值以获取不在数据库中的ID,例如:60。它应该打印“未找到”而不是打印找到!这是为什么?$main=newMainClass();$subid=mysqli_real_escape_string($main->MsqlConRes,$_GET['sub']);if(is_numeric($subid)){$main->query=mysqli_query($main->MsqlConRes,"SELECT*FROMsubjectsWHEREid=".$subid."")ordie(mysqli_error());if($main->

php - 有人可以解释一下关于 mysqli close 函数的声明吗?

在mysqli文档站点上列出,其中一条评论说Youshouldalwaysusemysqli_kill()functionbeforemysqli_close()toactuallycloseandfreeupthetcpsocketbeingusedbyPHP.Garbagecollectionafterscriptexecutionnormysqli_close()donotkillthetcpsocketontheirown.Thesocketwouldotherwiseremainin'wait'stateforapproximately30seconds,andanyaddi

php - 将 BYTEA 绑定(bind)到 PHP5 中的 PGSQL PDO 准备语句

我似乎找不到使用PHP5的PDO和PostgreSQL将bytea绑定(bind)到准备好的语句的方法。这是我想象中的工作方式......$this->stmtPDO=$this->hPDO->prepare('INSERTINTOboard.feedback("created","title","payloaddata")VALUES(NOW(),:title,:payload)RETURNINGpsk;',array(PDO::ATTR_CURSOR,PDO::CURSOR_SCROLL));$this->stmtPDO->bindParam(":payload",$payload