草庐IT

CI_DB_mysqli_result

全部标签

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 - Doctrine DBAL ->execute() 和 Hydration 与 DB2 字段名称包括 '#'

我正在尝试使用DoctrineDBAL实现模型/映射器类型的交互,但遇到了一些问题。我的一些列名称末尾有一个“#”。更改名称不是一种选择。${'COL1#'}语法适用于常规变量,但是当它用作对象属性时,PHP似乎遇到了困难。解析错误:语法错误,意外的“$”,需要变量(T_VARIABLEin...如何为字段名称中带有井号标签的表建立模型? 最佳答案 你可以createviewsinMySQL并将您的列重命名为在这些View中更友好的名称(不带#的名称)...?这样您就不必更改原始表,但您仍然可以解决这些命名问题。Doctrine也支

php - DB 中的双引号破坏 HTML 输出

我什么都试过了,还是想不通。addslahes()、str_replace()、htmlentities(),我只是不明白为什么我的网站上没有显示双引号。$sql=$con->prepare("SELECT*FROM`user_settings`WHERE`user_session`='$user_session'");$sql->execute();$result=$sql->fetchAll(PDO::FETCH_ASSOC);foreach($resultas$row){$advertising_1=$row['advertising_1'];$advertising_2=$ro

php - 将变量值从库传递到 Controller ,然后在 CI 3.0 中查看

我正在尝试将变量值从库函数传递到Controller,然后查看以获取输出。为此,我的库代码:developers_url.'search';$fields=array("token"=>$this->token);$result=$this->_post_api($fields,$url);$this->log("result");$this->log($result);}privatefunction_post_api(Array$fields,$url){try{$ch=curl_init();curl_setopt($ch,CURLOPT_URL,$url);curl_setop

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 - Travis CI 构建 PHP 项目并从 Composer 中提取依赖项,尝试使用 git@ 而不是 https

背景我们有一个PHPproject这与TravisCI配合得很好直到某一点,从那时起就完全停止工作了。该项目无法使用Composer进行构建。详情最后一次成功构建是:thisone最近失败的构建是:thisone,inthebranchNamingCollisions这是thiscommit不断出现的错误是:Failedtoexecutegitclone--mirror'git@github.com:edmondscommerce/Faker.git''/home/travis/.composer/cache/vcs/git-github.com-edmondscommerce-Fak

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 - 如何使用 Zend_Db_Adapter 在每次调用 "query"时运行多个 SQL 查询?

这是我编写的一个Zend_Application_Resource,用于在部署中进行更改时自动更新模式。getOptions();$version=(int)$options['version'];return$version;}/***Returnstheversionthedatabasethinksitis.**@returnint*/privatefunctionGetDbVersion(){$adapter=Zend_Db_Table::getDefaultAdapter();$metadataTable=newCas_Model_Table_Metadata;$verQue