使用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
最满意答案
你说你的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 indbConnect
, then it probably uses the default port,3306
, so it should not be able to connect... add the port argument to your dbConnectdbConnect(MySQL(), user="user", password="password", dbname="dbname", host="localhost", port="1527")
相关问答
更多-
有什么数据库专业书籍介绍?[2022-05-19]
mysql -
这不是一个直接的答案,但你可能会发现它有帮助: 使用更新版本的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 ...
-
无法使用R连接MySQL(Unable to connect MySQL using R)[2020-01-02]
你说你的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 nodejs(Unable to connect mysql nodejs)[2022-06-26]
对于与远程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 ... -
android连接mysql(android connect mysql)[2022-05-09]
问题是我忘了在清单中提供Internet访问权限。 The problem was that I forgot to give Internet access permission in the manifest.