【发布时间】:2014-11-05 21:37:12
【问题描述】:
所以,当我在 MySQL 中使用 php 时,我只是这样做了:
$result = $mysqli->query("SELECT * FROM table WHERE person='Bob'");
我现在将 PHP 与 XML 一起使用,但我不知道如何执行此操作。我试过用谷歌搜索,但我不知道这在 XML 中会叫什么。
我的 XML 是:
<People>
<person>Bob</person>
<about>Bob is a blob. He is 20 Years old, etc</about>
</People>
<People>
<person>Jim</person>
<about>Jim is 90 Years old, he plays basketball, etc</about>
</People>
<People>
<person>Steve</person>
<about>Steve is a superhero with the ability to fly.</about>
</People>
我基本上是在尝试回应某个人的信息。因此,如果用户搜索 Jim,它会回显:
Name: Jim About: Jim is 90 Years old, he plays basketball, etc
【问题讨论】:
-
拜托,don't use
mysql_*functions,它们不再维护,而是officially deprecated。改为了解prepared statements,并使用PDO 或MySQLi。 This article 将帮助您做出决定。