草庐IT

Mysqli_result

全部标签

php - CodeIgniter:通过 ActiveRecord 结果 ID 将 $subresult 添加到对象 $result

我在向Codeigniter中的结果添加“子结果”时遇到问题。不确定如何添加到此对象。$result->{$record_id}->threads=$threads;应该等于这样$result->1->threads=$threads;但我无法让它工作...我不是OOP的新手,但这是我第一次尝试这样做。db->select(array('record_id','record_data','record_date',));$this->db->from('records');$sql=$this->db->get();$records=$sql->result();foreach($re

php - 准备好的语句和 mysqli_query 之间有什么区别?

我读过一本关于PHP和MySQL的书。准备好的语句使用二进制协议(protocol),但mysqli缺少此功能。我还读到可以缓存准备好的语句(它们的执行计划)并且比mysqli_query更快,当然更安全?我们什么时候应该使用准备好的语句,什么时候使用mysqli_query?编辑假设我有以下查询:echo"";echo"NameLocationReviewImageThumb";while($row=mysql_fetch_array($query)){echo"";echo"".$row['user_fname']."";echo"".$row['user_location']."

php - 警告 : mysql_data_seek(): Offset 1 is invalid for MySQL result index 5 (or the query data is unbuffered)

请任何人提供帮助。我正在尝试执行以下php代码:$sql="SELECT*FROMvendorsWHEREvuid=".$uid."ANDstatus="."'c'";$sql=$sql."LIMIT0,10";$result=mysql_query($sql);$numrows=mysql_num_rows($result);for($i=0;$i0){mysql_data_seek($result,$i);}我收到以下错误警告:mysql_data_seek():偏移量1对于MySQL结果索引5无效(或查询数据未缓冲)。$numrows为2,因此mysql_data_seek的范围

php - 故障排除 "Warning: mysqli_result::fetch_array() expects parameter 1 to be long, object given"

我收到的警告是:Warning:mysqli_result::fetch_array()expectsparameter1tobelong,objectgivenin...line103.我在第103行旁边注释了while($row=$result->fetch_array($result)){问题2:我可以将其中的任何内容存储在包含文件中吗?问题3:对于$query,我可以将这些Buyer、Seller中的任何一个存储在某个数组中吗?怎么办?/*FETCHCONTACTINFORMATION*/$query=("SELECT*FROMcontactsWHEREcontacttypeI

php - 不能在 mysqli_stmt 对象上使用 call_user_func_array

我正在为MySQLi编写一个包装器类。在那里,我正在编写一个函数来接受查询和可变数量的参数,我可以在其中调用mysqli_stmt::bind_param。这是代码:open();#OpensaconnectiontothedatabaseusingMySQLiAPI$stmt=$this->mysqli->prepare($query);try{$result=call_user_func_array(array($stmt,'bind_param'),$params);}catch(Exception$ex){#HandleException}}....}?>下面是我调用该函数的方

php - MySQLi 未找到错误

我刚刚将我的网站部署到暂存环境,但出现以下错误:Fatalerror:Class'mysqli'notfoundinD:\ClientSites\baileyboiler.com\www\new\php\db.phponline11起初我假设MySQLI根本没有安装,但是运行phpinfo()显示以下内容:对我来说,它看起来像是安装了MySQLI(尽管我可能读错了)。我该怎么办?代码classDB{publicstaticfunctionGetConnection(){returnnewmysqli(DBHOST,DBUSER,DBPASSWORD,DEFAULTDATABASE);}

php - MySQLi 更新的增量值

只是尝试将点添加到名为“Points”的列中的现有值。我读过几篇建议下面的文章,但它对我不起作用。也许是因为我使用的是mysqli而不是mysql?有什么想法吗?if语句工作正常。if(!empty($m1A)&&($r1A==0)){//Rewardspts$query="UPDATEusersSETPoints=Points+3WHERE1A='$m1A'";$result=mysqli_query($conn,$query);//Recordrewardofpts$query1="UPDATEroundsSET1A=1";$result2=mysqli_query($conn,$

php - 如何调试mysqli_query?

这个问题在这里已经有了答案:Whattodowithmysqliproblems?Errorslikemysqli_fetch_array():Argument#1mustbeoftypemysqli_resultandsuch(1个回答)关闭8年前。我连接到我的数据库:$con=mysqli_connect("localhost","xxxx","xxxxx","xxxxxx");//Checkconnectionif(mysqli_connect_errno()){echo"FailedtoconnecttoMySQL:".mysqli_connect_error();}没有返回错

php blowfish 哈希与 crypt() : the CLI result differs from webserver's one

当我使用使用Blowfish算法的php函数crypt()时withweb-server:我得到这个结果:$2a$10$7711cbpe58dfpogiu0498u5Vh773A3qx.3LE3ro3NX7F9c9N7.pOm但是如果我使用PHP解释器命令行:php-r"echocrypt('SAD123',sprintf('$2a$10$%s','7711cbpe58dfpogiu049857f011werb0'));"我得到另一个结果:a0SqNHxQ8/2mA你有什么想法吗?系统是:Apache/2.2.3(CentOS),PHP版本5.4.26 最佳

php - mysqli 查询返回错误值

我正在制作一个函数,它返回连接到用户ID的特定用户的请求字段,我当前的代码是这样的:prepare("SELECT:fieldFROM`users`WHERE`ID`=:IDLIMIT1;");$query->bindParam(":ID",$id);$query->bindParam(":field",$field);$query->execute();while($row=$query->fetch(PDO::FETCH_BOTH)){print_r($row);}//return$username;}?>如果$id值保持为空,它会查找当前登录的ID,这工作正常。如果$field为