草庐IT

mysqli_query

全部标签

php - fatal error :调用未定义的方法 mysqli_result::fetch_all()

我在Ubuntu10.04中遇到PHP问题。当我尝试使用mysqli_result::fetch_all时出现此错误:调用未定义方法mysqli_result::fetch_all()但是,它适用于WindowsXP。代码:$result=$this->dbh->query('SELECT[...]');return$result->fetch_all(MYSQLI_ASSOC);我不想将fetch_assoc与循环一起使用,因为我将结果发送到另一层进行处理。我使用的是PHP5.4.4。和php-m|grepmysql它没有出现的mysqlnd模块。我该如何安装它?这可能是问题所在吗?

php - 错误:预期的 Doctrine\ORM\Query\Lexer::T_WITH,得到 'ON'

我编写了以下代码用于从数据库中获取数据:functiongetnotificationAction(){$session=$this->getRequest()->getSession();$userId=$session->get('userid');$entitymanager=$this->getDoctrine()->getEntityManager();$notification=$entitymanager->getRepository('IGCNotificationBundle:Notifications');$userNotification=$entitymanag

php - Mysqli Prepare 语句 - 返回 False,但为什么?

这个问题在这里已经有了答案:Whattodowithmysqliproblems?Errorslikemysqli_fetch_array():Argument#1mustbeoftypemysqli_resultandsuch(1个回答)关闭去年。我有一个函数,它根据要插入该列的列名和值的关联数组以及表名(简单字符串)生成准备好的INSERT语句:functioninsert($param,$table){$sqlString="INSERTINTO$table(".implode(',',array_keys($param)).')VALUES('.str_repeat('?,',

php - 将查询错误转换为 MySQLi 中的异常

这个问题在这里已经有了答案:Whattodowithmysqliproblems?Errorslikemysqli_fetch_array():Argument#1mustbeoftypemysqli_resultandsuch(1个回答)关闭2年前。我正在尝试将MySQLi查询错误转换为异常,但不能-mysqli_sql_exception只有在连接数据库失败时才会抛出。我使用mysqli_report(MYSQLI_REPORT_STRICT)和嵌入到自定义包装类的程序MySQLi函数。旧代码:publicfunctionmysqlQuery($SQL){$this->Result

php - utf 8 - PHP 和 MySQLi UTF8

这个问题在这里已经有了答案:UTF-8allthewaythrough(13个答案)关闭2年前。我的表字符集是utf8,它的排序规则是utf8。现在我有这段代码:$mysqli=newmysqli("localhost","root","","Amoozeshgah");if(mysqli_connect_errno()){printf("Connectfailed:%s\n",mysqli_connect_error());}if(!$mysqli->set_charset("utf8")){printf("Errorloadingcharactersetutf8:%s\n",$my

c# - 尝试在 MongoDB MapReduce 调用中包含 Query

我正在尝试创建一个非常基本的map-reduce示例,该示例还在MapReduceapi调用中包含一个查询。我的收藏有很多格式如下:{"_id":{"$binary":"PdYV4WMTAEyYMQHXJZfzvA==","$type":"03"},"firstname":"Matthew","surname":"Chambers","email":""}代码如下:varmap=@"function(){emit(this.surname,{count:22});}";varreduce=@"function(key,emitValues){return{count:emitValue

c# - 尝试在 MongoDB MapReduce 调用中包含 Query

我正在尝试创建一个非常基本的map-reduce示例,该示例还在MapReduceapi调用中包含一个查询。我的收藏有很多格式如下:{"_id":{"$binary":"PdYV4WMTAEyYMQHXJZfzvA==","$type":"03"},"firstname":"Matthew","surname":"Chambers","email":""}代码如下:varmap=@"function(){emit(this.surname,{count:22});}";varreduce=@"function(key,emitValues){return{count:emitValue

php - 关闭语句后的mysqli + xdebug断点导致许多警告

我有一段代码是这样的:$conn=newmysqli($host,$username,$passwd,$dbname);...$stmt=$conn->prepare('SELECT...');$stmt->bind_param(...);$stmt->execute();$stmt->bind_result(...);while($stmt->fetch()){//dosomethinghere}$stmt->close();...//dosomethingmoreherethathasabsolutelynothingtodowith$stmt这工作得很好。我得到了预期的结果,没有

php - 如何将多个参数绑定(bind)到 MySQLi 查询

这个问题不太可能帮助任何future的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visitthehelpcenter.关闭9年前。我有一个mysql查询,但是我不能为它绑定(bind)参数SELECTusers.email,users.handle,userprofile.mobileFROMusers,userprofileWHEREusers.email=?ORusers.handle=?ORuserprofile.mobile=?我试过下面的行$query="SELECTuse

php - 在 MySQLi 中选择 * FROM

我的网站相当广泛,我最近才切换到PHP5(称我为大器晚成)。我之前的所有MySQL查询都是这样构建的:"SELECT*FROMtablenameWHEREfield1='value'&&field2='value2'";这使它变得非常容易、简单和友好。出于明显的安全原因,我现在正尝试切换到mysqli,并且我很难弄清楚当bind_paramSELECT*FROM查询需要特定的参数。这种说法是否已成为过去?如果是,我该如何处理涉及大量列的查询?我真的需要每次都打出来吗? 最佳答案 我可能是错的,但对于你的问题,我觉得bind_para