PHP 和 MySQL - 打印与列值匹配的行
我需要编写一个 PHP 脚本来打印 MySQL 数据库的结果。例如,假设我有 9 个字段。字段 1 是一个自动递增的数字,字段 2 是一个三位数。
我需要能够读取脚本,找到匹配的号码(来自 POST),然后显示所有匹配的三位数结果,以及其他 7 个字段。我已经在此脚本中登录到数据库。
我想我真的不知道从哪里开始。人们如何开始这样的事情呢?
谢谢。
I need to write a PHP script that will print out results from a MySQL database. For example, say I have 9 fields. Field 1 is an auto increasing number, field two is a three digit number.
I need to be able to have a script read, find the matching number (it'll be from a POST), and then display all matching three digit results, and the 7 other fields as well. I am already logged in to the database in this script.
I guess I'm really at a loss of where to begin. How would one start something like this?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于您已经连接到数据库,因此您所要做的就是查询数据库并迭代结果。这是一个简单的例子。
Since you are already connected to the database, all you have to do is query the database the iterate through the results. Here is a quick example.
谷歌搜索“php mysql”。
例如: http://www.php.net/manual/en /function.mysql-query.php
你应该从一些关于 SQL、PHP 等的初学者手册开始。
Google around searching "php mysql".
For example: http://www.php.net/manual/en/function.mysql-query.php
You should start with some manual for beginners about SQL, PHP, etc.