首页 \ 问答 \ 使用php从数据库中选择值,其中条件值类似于输入(Select value from database with php where condition value is similar to input)

使用php从数据库中选择值,其中条件值类似于输入(Select value from database with php where condition value is similar to input)

我想知道....如果WHERE语句的值类似于输入文本,是否可以从mysql数据库中检索值? 类似于similar_text()函数但应用于搜索条件。

例:

 <?php
   $res = mysqli_query(*CONECTION*,"SELECT value FROM table WHERE condition=*is similar to x*");
  ?>

如果有可能,请告诉我如何。


I was wondering....is it possible to retrieve a value from a mysql database if the value of the WHERE statement is similar to the input text? Something like the similar_text() function but applied to the search condition.

Example:

 <?php
   $res = mysqli_query(*CONECTION*,"SELECT value FROM table WHERE condition=*is similar to x*");
  ?>

If this thing is possible please tell me how.


原文:https://stackoverflow.com/questions/19744067
更新时间:2023-06-24 12:06

最满意答案

你说你的mysql在localhost:1527上运行 - 但是你没有在dbConnect指定那个端口,那么它可能使用默认端口3306 ,所以它应该无法连接...将port参数添加到你的数据库连接

dbConnect(MySQL(), user="user", password="password", dbname="dbname", host="localhost", port="1527")

you say that your mysql is running on localhost:1527 - but you don't specify that port in dbConnect, then it probably uses the default port, 3306, so it should not be able to connect... add the port argument to your dbConnect

dbConnect(MySQL(), user="user", password="password", dbname="dbname", host="localhost", port="1527")

相关问答

更多
  • 这不是一个直接的答案,但你可能会发现它有帮助: 使用更新版本的R(目前在2.15) 在Windows平台上,我宁愿使用RODBC + Windows MySQL驱动程序,除非您处于具有异质平台(即Linux和Windows)的环境中,其中代码在团队成员之间大量共享。 而且,即使在使用RMySQL和RODBC的同一脚本之间进行选择,取决于它运行的平台是一个简单的if() {...} else {...} 请注意,我并不是说你没有成功的故事,但你可以通过上述方法尽快完成并运行。 It is not a dire ...
  • 使用R Console,输入以下步骤以建立Teradata连接: drv = JDBC("com.teradata.jdbc.TeraDriver","ClasspathForTeradataJDBCDriverFiles") 例: drv = JDBC("com.teradata.jdbc.TeraDriver","c:\\terajdbc\\terajdbc4.jar;c:\\terajdbc\\tdgssconfig.jar") 注:UNIX机器上的路径将使用单个正斜杠来分隔其组件和文件之间 ...
  • 在您的数据库中似乎是usr“sam”的权限问题。 您应该检查mysql.users表并提供必要的权限,如果您尝试从远程服务器访问,则应在users表中添加用户名=“sam”的远程服务器的IP地址 It seems permission issue for usr "sam" in your database. You should check mysql.users table and provide necessary permissions, if you are trying to access fr ...
  • 首先建立一个连接。 1)对于我来说,我不得不在MySql的网站上下载驱动程序,该驱动程序因系统和版本而异,我使用了此页面: Windows ODBC驱动程序 2)一旦下载完成,运行安装程序。 3)接下来设置DSN。 Windows的说明在这里: MySQL的ODBC DSN设置 4)重要信息:请记住在RODBC中创建通道以连接到数据库时使用的DSN的名称。 5)最后,一旦设置完成,您可以安装并加载RODBC软件包。 6)连接到你的数据库使用这样的东西: channel <- odbcConnect("mys ...
  • 最后我能够通过R连接到cassandra。我按照以下步骤操作: 我将我的java 7和R更新到了最新版本。 然后,我重新安装了RJDBC,rJava,DBI 然后,我使用以下代码,并成功连接: library(RJDBC) drv <- JDBC("org.apache.cassandra.cql.jdbc.CassandraDriver", list.files("D:/cassandra/lib/",pattern="jar$",full.names=T)) .jaddClassPath("D:/m ...
  • 你说你的mysql在localhost:1527上运行 - 但是你没有在dbConnect指定那个端口,那么它可能使用默认端口3306 ,所以它应该无法连接...将port参数添加到你的数据库连接 dbConnect(MySQL(), user="user", password="password", dbname="dbname", host="localhost", port="1527") you say that your mysql is running on localhost:1527 - ...
  • 我建议的最简单的解决方案是安装RMySQL 。 这将为您提供与您正在使用的MySQL数据库的本机连接。 如果您想使用ODBC而不需要MySQL ODBC驱动程序 ,则需要在Windows XP上的ODBC管理器中设置ODBC连接。 当你通过连接时,它会询问你一个名字,它将是你的DSN名称,然后你应该可以在odbcConnect() The simplest solution I can suggest would be installing RMySQL. This will give you native ...
  • 对于与远程MySQL服务器的连接,请省略socketPath选项,因为只有当MySQL服务器与您的应用程序在同一主机上运行时才有意义。 这确实需要将MySQL服务器设置为允许通过TCP进行连接。 For connections to a remote MySQL server, leave out the socketPath option, because that only makes sense if the MySQL server is running on the same host as yo ...
  • 问题是我忘了在清单中提供Internet访问权限。 The problem was that I forgot to give Internet access permission in the manifest.

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。