草庐IT

Mysqli_result

全部标签

php/mysqli : should I free_result before I return?

Ifcalledfromwithinafunction,thereturnstatementimmediatelyendsexecutionofthecurrentfunction,andreturnsitsargumentasthevalueofthefunctioncall.引自php手册:http://php.net/manual/en/function.return.php所以如果我要编写这个函数:publicfunctioncheck_db_for_desired_value(){//...connecttodb,preparestmt,etc.while(mysqli_st

php - 如何在 mysqli 中转换 mysql_result?

这个问题在这里已经有了答案:Singleresultfromdatabaseusingmysqli(6个答案)关闭8个月前。这段代码以前在mysql中,现在因为它已被弃用,我决定在mysqli中转换我的代码,但是我在我的页面中遇到了这个问题,在它与mysql一起工作之前没有错误,但是我的页面有分页现在我在这一行中得到一个错误:Warning:mysqli_fetch_assoc()expectsexactly1parameter,2given这个错误很明显,我知道,但我不知道如何用另一种方式来做,因为之前我在那行的代码是$pages=ceil(mysql_result($pages_q

php - 提交或回滚是否在 PHP 的 mysqli 中隐式打开自动提交?

我在PHP中使用mysqli类进行事务处理,我发现autocommit()的文档非常不完整。我从示例中推断,将autocommit设置为false会隐式执行“开始事务”。这个对吗?更重要的是,我没有看到autocommit在哪里重置为true,我认为它应该在事务完成后重置。这会在调用commit()或rollback()方法时自动发生吗? 最佳答案 它不会隐式执行STARTTRANSACTION,因为它执行临时事务:http://dev.mysql.com/doc/refman/5.0/en/commit.html使用autocom

php - mysqli_query() 警告参数 1 为 mysqli,给定为空。数据库查询失败

我收到这个警告:(!)Warning:mysqli_query()expectsparameter1tobemysqli,nullgiveninC:\wamp\www\inc\functions.phponline73CallStack#TimeMemoryFunctionLocation10.0003251048{main}()..\manage_user.php:020.0012295000find_all_users()..\manage_user.php:830.0012295376mysqli_query()..\functions.php:73Databasequeryfa

php - mysqli_fetch_assoc 在第一行死了

我在MySQL中有下表:╔══════╦════╗║...城市.....║...zip..║╠══════╬════╣║布拉格。║11000║║bool诺.....║34785║╚═══════════╝以下代码有效:ClassMysql{functionconnect(){$this->c=newmysqli($this->OPTION['dbhost'],$this->OPTION['dbuser'],$this->OPTION['dbpass'],$this->OPTION['dbname']);if($this->c->connect_errno){exit("Connectf

php - 如何在考虑事务的情况下使用prepare语句向MySQLi中的三个不同表插入数据

什么是同时执行以下SQL语句的完美和最安全的方式,考虑到MySQLi中的事务,以便将数据添加到所有表中,或者当添加过程发生故障时需要回滚数据一个在table上。$conn=newmysqli(DBHOST,DBUSER,DBPASS,DBNAME);$stmt1=$conn->prepare("INSERTINTOstdHouseholder(usersID,parentJob,phoneNumber,address)VALUES(?,?,?,?)");$stmt1->bind_param("ssss",$userId,$parentJob,$phoneB,$addressB);$st

php - 查询在使用 mysqli 的 php 中无法正常工作

**DELETE.php**这是我的delete.php文件删除查询工作正常。但是两个更新查询工作错误。它只是从$quan设置数量。我需要马上提前致谢。 最佳答案 在您的第二个和第三个SELECT语句中,我认为您可能需要在$sub周围添加单引号,因此它们将是:$check1=mysqli_query($conn,"SELECT*FROMinstockWHEREs_brand='$sub'");和$check2=mysqli_query($conn,"SELECT*FROMoutstockWHEREs_brand='$sub'");

php - mysqli 查询没有结果 做点别的事 做点别的事

我正在运行mysqli查询。这是我的代码query($SM_pro_info)ordie($db->error);if($QSM_pro_info->num_rows>0){while($SM_pro=$QSM_pro_info->fetch_object()){?>pro_title;?>image_1;?>"alt=""width="60"height="60"border="0"/>الغرض:pro_purpose;?>num_rows);$x++){echo'Youradhere';//or,whateveryouradtextis}}?>现在我想做的就是如果有任何来自mys

php - MySqli 无法连接到本地主机

这个问题在这里已经有了答案:MySQL:Accessdeniedforuser'test'@'localhost'(usingpassword:YES)exceptrootuser(18个答案)关闭去年。我有这行代码:$mysqli=newmysqli("localhost","user","pass","db");我正在为Apache和MySQL使用XAMPP。如果我使用上面的行,它会抛出以下错误:Warning:mysqli::mysqli():(HY000/1045):Accessdeniedforuser'user'@'localhost'(usingpassword:YES)

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

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