所以,當我使用PHP與MySQL我只是做:從XML文件中選擇所有的人在哪裏=「鮑勃」
$result = $mysqli->query("SELECT * FROM table WHERE person='Bob'");
我現在使用PHP的XML和我沒有帶一個線索如何做這個。我試過Google搜索,但我不知道這將在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>
基本上,我想回應某個人的信息。因此,如果吉姆用戶搜索,將呼應:
Name: Jim About: Jim is 90 Years old, he plays basketball, etc
http://en.wikipedia.org/wiki/XPath – 2014-11-05 21:41:37
請,[唐」使用'mysql_ *'函數](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php),它們不再被維護並且是[offic最後棄用](https://wiki.php.net/rfc/mysql_deprecation)。學習[準備的語句](http://en.wikipedia.org/wiki/Prepared_statement),並使用[PDO](http://us1.php.net/pdo)或[MySQLi](http:// us1.php.net/mysqli)。 [本文](http://php.net/manual/en/mysqlinfo.api.choosing.php)將幫助你決定。 – 2014-11-05 21:47:07