草庐IT

Mysqli_result

全部标签

php - 拉维尔 5 : Replace string in query results (Eloquent ORM)

是否可以返回表中的所有列,但如果字符串(值)包含特定单词,则删除该单词?比如我有这样一张表:-------------------------------------------------|id|article_desc|article_link|active||----|------------------|----------------|--------||1|Hello,world!|http://test.co|0||2|ReplaceWordTest|http://null.org|1|-------------------------------------------

PHP- mysqli->num_rows 总是返回 0,准备语句

首先,我想告诉大家,我已经解决了ALLDUPLICATE问题。并尝试了那里建议的更改。到目前为止,我已经尝试将num_rows更改为num_rows()并使用store_result();并使用affected_rows()。也在execute()之后调用store_result();我想可能还有其他我想不通的问题$conn->autocommit(false);if($sucess){$stmt2=$conn->prepare("UPDATEe_eventqueueSETe_urlfil=?WHEREe_id=?ANDu_id=?");$stmt2->bind_param("iis"

php - 将此 MySQLi 查询编写为准备好的语句

我有一个现有的MySQLi查询:$conn=dbConnect('query');$galNumb="SELECTCOUNT(pj_gallery_id)FROMpj_galleriesWHEREproject={$project}";$gNumb=$conn->query($galNumb);$row=$gNumb->fetch_row();$galTotal=$row[0];这会计算每个项目与$project中包含的查询字符串中的值相匹配的画廊数量。它工作完美,但与准备好的语句相比并不安全。我已经研究了两天,无法学习如何将此语句编写为准备好的语句。我们将不胜感激任何和所有帮助。更新

php - 在 CodeIgniter 中跳过 csv_from_result() 中的第一行

我正在尝试使用CodeIgniter中的csv_from_result()将仅包含两个字段id、email的简单表格导出到CSV文件.生成的CSV文件的第一行包含列的名称,但我只想要数据。有什么办法可以跳过第一行吗?这是我的代码:$query=$this->EE->db->query("SELECTemailFROMexp_sct_mailing_list");$this->EE->load->dbutil();$data=$this->EE->dbutil->csv_from_result($query,",","\r\n");$this->EE->load->helper('dow

php - mysqli 图像 blob 插入不工作

我正在尝试将图像文件上传到我的MySql数据库。我已经在网上搜索了,我终于开始使用以下脚本:if(is_uploaded_file($_FILES['filename']['tmp_name'])){$maxsize=$_POST['MAX_FILE_SIZE'];$size=$_FILES['filename']['size'];//gettingtheimageinfo..$imgdetails=getimagesize($_FILES['filename']['tmp_name']);$mime_type=$imgdetails['mime'];//checkingforvali

php - mysqli_connect 会在脚本结束时自动关闭吗?

我想知道mysqli_connect()是否会在脚本结束时自动关闭。我知道,mysql_connect()确实如此,但我说的是改进的mysqli_connect()。我还找到了已回答的问题,说是这样,但在官方文档中它没有写..那么,我可以依赖那些非官方声明吗?(或者更好地问,依赖它们是安全的吗?) 最佳答案 这是您应该考虑的事项。当脚本终止时,MySql连接会自动关闭。但是,如果您的脚本在数据被检索并存储到数组或您将其存储到的任何位置后进行了大量处理,那么显式关闭连接会更安全,这样您就不会面临可用连接耗尽的机会脚本正忙于运行后期数据

php - mysqli bind_param 中的动态变量绑定(bind)

当我尝试低于代码时,它会给我一个警告mysqli_stmt::bind_param():Numberofelementsintypedefinitionstringdoesn'tmatchnumberofbindvariables$stmt=$mysqli->prepare('SELECT*FROMusersWHERElname=?ANDfname=?');$type="ss";$param=array("Maq","bool");$params[]=&$type;$params[]=&$param;call_user_func_array(array($stmt,'bind_para

php - mysqli_real_escape_string() 中默认字符集的安全隐患是什么意思?

在mysqli_real_escape_string()的PHP文档中,写道CautionSecurity:thedefaultcharactersetThecharactersetmustbeseteitherattheserverlevel,orwiththeAPIfunctionmysqli_set_charset()forittoaffectmysqli_real_escape_string().来源mysqli_real_escape_string在关于字符集的进一步链接中,提到Thecharactersetshouldbeunderstoodanddefined,asith

phpMyAdmin - 错误 : (The mysqli extension is missing) after upgrading php 5. 6 到 php 7

通过这种方式将php5.6升级到php7后,ubuntu16.04上的phpmyadmin出现问题:sudoadd-apt-repositoryppa:ondrej/phpsudoapt-getupdatesudoapt-getinstallphp7.0php5.6php5.6-mysqlphp-gettextphp5.6-mbstringphp-mbstringphp7.0-mbstringphp-xdebuglibapache2-mod-php5.6libapache2-mod-php7.0在这个命令之后:sudoa2dismodphp5.6;sudoa2enmodphp7.0;s

php - 是否安全 :cipher encrypted result depend on the server?

我在一个cakephp应用程序中工作,我在其中使用Security::cipher来加密一些数据。它工作得很好,但我已经将文件和数据库移动到另一台服务器,现在加密结果不同了。我试过一些简单的线条:$security=newSecurity;$code=$security->cipher('1234',Configure::read('Security.cipherSeed'));当我打印$code时,两个服务器中的值不同。我在两个core.php文件中配置了相同的Security.cipherSeed。Security::cipher函数是否使用某些服务器值进行加密?谢谢。