首页 \ 问答 \ 使用php的MySql多重查询的建议(Advice on MySql multi query using php)

使用php的MySql多重查询的建议(Advice on MySql multi query using php)

让我从这开始..我从来没有使用.php脚本进行编程,而且对编程还比较陌生,我正在开发一个以Android Studio IDE为中心的新项目,我通常使用JAVA编写。 我一直在尝试使用下面这个.php脚本,我一直在用我需要的修改。 它运作良好,但是,我很难找出如何做一个多重查询,基本上我正在寻找我的'回声'线,但如果有多个匹配到FSC / NIIN领域,那么它应该显示我额外的比赛。

返回历史记录,列出了一些FSC / NIIN字段中的多个零件号,我正努力让它显示与库存号(FSC / NIIN)相匹配的附加零件号。 任何帮助或建议非常感谢!

<?php 
require "conn.php";
$FSC = $_POST["FSC"];
$NIIN = $_POST["NIIN"];
$mysql_qry = "select * from MYTAB where FSC like '$FSC' and NIIN like 
'$NIIN';";
$result = mysqli_query($conn ,$mysql_qry);

if(mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_assoc($result);
$PART_NUMBER = $row["PART_NUMBER"];
$FSC = $row["FSC"];
$NIIN = $row["NIIN"];
$ITEM_NAME = $row["ITEM_NAME"];

echo $ITEM_NAME, ", " .$PART_NUMBER, ", " .$FSC, ", " .$NIIN;
} else {
echo "Query Failed! - No such NSN is loaded to the database! Please double 
check the information is correct and resubmit request...";
}

mysqli_close($con);

?>

Let me start with this.. I've never programmed using .php script, and still relatively new to programming, I am working on a new project that centers around Android Studio IDE and I usually write in JAVA. I have been trying to use this .php script below that I've been modifying with what I need. It works well however, I am having trouble figuring out how to do a multi query, basically I am looking to have what my 'echo' line is but if there are more then one match to the FSC/NIIN field then it should show me the additional matches.

Back history, there are more than one part number listed for some FSC/NIIN fields, I am working towards having it show those additional part numbers that match the stock number (FSC/NIIN). Any help or advice is greatly appreciated!

<?php 
require "conn.php";
$FSC = $_POST["FSC"];
$NIIN = $_POST["NIIN"];
$mysql_qry = "select * from MYTAB where FSC like '$FSC' and NIIN like 
'$NIIN';";
$result = mysqli_query($conn ,$mysql_qry);

if(mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_assoc($result);
$PART_NUMBER = $row["PART_NUMBER"];
$FSC = $row["FSC"];
$NIIN = $row["NIIN"];
$ITEM_NAME = $row["ITEM_NAME"];

echo $ITEM_NAME, ", " .$PART_NUMBER, ", " .$FSC, ", " .$NIIN;
} else {
echo "Query Failed! - No such NSN is loaded to the database! Please double 
check the information is correct and resubmit request...";
}

mysqli_close($con);

?>

原文:https://stackoverflow.com/questions/48408525
更新时间:2022-02-15 13:02

最满意答案

我正在考虑的一个项目是帮助管理我十几岁的儿子的互联网使用。

Windows有一个基于UI的工具来控制登录时间。 一个WPF前端将很好地复制或改进该工具,但使用它来设置网络使用时间。 这样,孩子们可以做学校工作(不禁止登录他们的电脑),但不会被Facebook分心。

WCF部分将是您计算机上的WCF服务,以及孩子们计算机上的WCF客户端。 孩子们的电脑会定期检查限制更新。 如果网络访问是关闭的,那么客户端(在孩子们的计算机上)将关闭网络适配器(包括以太网和Wifi),每隔几分钟打开一次以检查更新,然后再关闭它们。

只需为要表示使用情况的任何结构/类别定义数据合同,该服务就会有一次操作合同,如下所示:

[ServiceContract]
interface INetworkControl
{
    [OperationContract]
    NetworkRestriction GetNetworkRestriction();
}

也许它需要更多; 这将取决于你(例如,将计算机名称作为参数传递,或者如果你想由用户控制,则可以登录用户,谁知道)。


A project I was thinking about was to help regulate my teenage son's internet usage.

Windows has a UI-based tool to control logon times. A WPF front-end would be nice to duplicate or improve on that tool, but use it to set network usage times. This way, kids could do school work (not prohibited from logging on their computer) but not be distracted by facebook.

The WCF portion would be a WCF service on your computer and WCF client on the kids' computers. The kids' computers would periodically check for restriction updates. If network access is current OFF, then the client (on the kids' computer) would turn off the network adapters (both ethernet and Wifi), turn them on every few minutes to check for updates, then turn them off again.

Just define a data contract for whatever structure/class you want to represent usage, and the service would have an operation contract with a single call, like:

[ServiceContract]
interface INetworkControl
{
    [OperationContract]
    NetworkRestriction GetNetworkRestriction();
}

Maybe it would need more; that would be up to you (i.e., pass the computer name as a parameter, or perhaps logged on user if you wanted to control by user, who knows).

相关问答

更多
  • 我正在考虑的一个项目是帮助管理我十几岁的儿子的互联网使用。 Windows有一个基于UI的工具来控制登录时间。 一个WPF前端将很好地复制或改进该工具,但使用它来设置网络使用时间。 这样,孩子们可以做学校工作(不禁止登录他们的电脑),但不会被Facebook分心。 WCF部分将是您计算机上的WCF服务,以及孩子们计算机上的WCF客户端。 孩子们的电脑会定期检查限制更新。 如果网络访问是关闭的,那么客户端(在孩子们的计算机上)将关闭网络适配器(包括以太网和Wifi),每隔几分钟打开一次以检查更新,然后再关闭它 ...
  • 你做的大部分事情都很好。 但对于日志记录模块:在您的基础结构中创建一个单独的项目,并将其注册为Unity的单例对象。 2-为了更好地对项目进行单元测试,请使用unity作为您的classe的依赖创建者,如依赖于合同而不是实际实现。 3-对于模块之间的通信,请使用EventAgreegator 4-对于全局命令,使用CompositeCommand。 5-如果您的UI具有像Combobox,ListBox这样的选择器控件,请尝试在Composite Application for Button base中扩展 ...
  • 在MVC和WPF(Windows)应用程序中,我们在配置文件中添加了以下绑定设置
    是否可以在WPF应用程序中拥有WCF侦听器/服务 在任何地方创建WCF服务侦听器/服务器相当简单。 var servicehost = new ServiceHost(typeof(SomeService)) servicehost.Open(); 一个问题是您必须拥有足够的权限才能看到主机。 您可能必须提升您的应用程序,并且肯定必须确保防火墙(软件/硬件)允许流量到达它。 此链接似乎涵盖WCF MSDN示例的网络设置,并适用于IIS主机,以及您的情况,非IIS托管的WCF: http://msdn.mi ...
  • 如果您的体系结构不允许“查看”服务引用中生成的类。 通常你需要DTO类,DTO代表“数据转换对象”或“数据传输对象”它的情况很重要。 因此,在“数据分析器”项目中,您的业务逻辑需要引用“wcfservice accessor”,而“数据显示器”则引用“数据分析器”。 因此,从“数据分析器”到“数据显示器”,您可以使用所谓的DTO对象。 if your architecture is not allowing to 'see' the classes generated in the service refe ...
  • 我通常通过DataSvcUtil.exe生成我的客户端,DataSvcUtil.exe是.net框架的一部分 例如 “%windir%\ Microsoft.NET \ Framework \ v4.0.30319 \ DataSvcUtil.exe”/ dataservicecollection /version:2.0 / language:CSharp /out:c:\temp\DataService.cs / uri: http:// localhost:16584 / DataService的/ ...
  • 您正在寻找的是某种联邦身份验证系统,所有入口点都使用该系统。 这就是Windows Identity Foundation可以帮助您构建的内容。 根据认证系统发布的每个用户的安全令牌中嵌入的权利要求,在每个应用程序内部,访问控制将基于声明。 在MSDN上有关于这个主题的整本书。 What you are looking for is some kind of federated authentication system which is used by all the entry points. That ...
  • 和WCF一起去吧! 这是要走的路,这是微软“互联系统”战略的现在和未来。 你可以使用WCF附加几乎任何东西 - 与Khalid相反,我不认为它有很高的学习曲线。 给自己一本好书 - 我推荐Michele Leroux Bustamante 学习WCF - 查看她的样本,玩这些。 还可以查看在线资源: MSDN上的WCF开发人员中心,包含大量文章,屏幕演员等。 Dotnet Rocks TV:Keith Elder揭开WCF的神秘面纱 Dotnet Rocks TV:Miguel Castro的Extreme ...
  • 这完全取决于您 - 只有应用程序作者才能做出这个决定。 如果您正在创建某种客户端/服务器应用程序,那么在大多数情况下,您将需要与服务器(Console + WCF)部分分开安装客户端(WPF)应用程序。 但是,有些情况需要告诉您将它们安装在一起 - 再次,只有您知道。 但还有另一个方面 - 在控制台主机中托管WCF服务可能不是生产代码的好主意。 你打算怎么跑? 如果每次用户登录时,那么这种服务的目的是什么 - 您也可以在WPF应用程序中保留相同的代码。 如果它必须是Windows服务,那么控制台应用程序将起 ...
  • 我认为更好的方法是考虑这个问题,是否应该使用服务接口从应用程序中抽象出数据库和数据访问层。 您可以使用WCF和SOAP,或者您可以使用基于REST的HTTP服务,技术的选择仅次于您的应用程序的当前或未来需求是否表明需要额外的抽象层。 您可能考虑使用服务接口而不是直接连接到SQL数据库的原因包括但不限于: 易于支持多个操作系统/客户端UI 能够与数据库模式分开地发展数据/服务接口 将应用程序与数据库架构或位置的更改隔离开来(您不必将更改重新部署到应用程序,只需更改它正在调用的服务的内部) 如果其他系统可以使用 ...

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)