好吧,我的问题很奇怪,因为它真的没有意义。
1)我有一个PHP脚本,它带来了一个XML,其中一些信息存储在我的MySQL数据库中;
2)当我第一次使用这个脚本(或任何其他脚本)时,它会给我带来所有更新的信息(所有注册表都插入到那一刻);
3)当我再次使用这个脚本(或任何其他)时,无论我的数据库中有多少新的注册表,它只会给我带来我第一次使用脚本时带来的注册表;
*我已经在我的浏览器上测试了这个脚本,它工作正常,总是带来数据库的最新状态。
我能做些什么?谢谢。
编辑:
1)我如何调用 XML 解析器:
NSString *strURL = @"localhost/scripts/bringmethexml-x5.php";
NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];
XMLProcessor *processor = [[XMLProcessor alloc]initProcessor];
[processor syncProcessorWithData:dataURL];
NSMutableArray *a = processor.xmlObjects;
2)我的PHP脚本:
<?php
header("Content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"LATIN-1\"?>";
echo "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">";
echo "<plist version=\"1.0\">";
function getXML($sql="SELECT user FROM database.Posts"){
$conn = mysql_connect ("localhost", "user", "password");
$db = mysql_select_db("database");
$result = mysql_query($sql, $conn);
$column = "";
echo "<array>";
while($row = mysql_fetch_assoc($result)){
$column .= "<dict>";
foreach ($row as $key => $value){
$column .= "<key>$key</key>";
$column .= "<string>$value</string>";
}
$column .= "</dict>";
}
echo $column;
echo "</array>";
echo "</plist>";
}
getXML("SELECT user as USER, msg as MESSAGE, hashtag_1 as ST1, hashtag_2 as ST2, hashtag_3 as ST3, hashtag_4 as ST4, hashtag_5 as ST5, date as DATEPOSTED, coordinate_lat as COORLAT, coordinate_lon as COORLON FROM database.Posts;");
mysql_close();
?>
3) 我的 XML 是如何输出的:
<?xml version="1.0" encoding="LATIN-1"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>(key || nome da fileira do db)</key>
<string>(valor||object)</string>
<key>(key || nome da fileira do db)</key>
<string>(valor||object)</string>
</dict>
<dict>
<key>(key || nome da fileira do db)</key>
<string>(valor||object)</string>
<key>(key || nome da fileira do db)</key>
<string>(valor||object)</string>
</dict>
</array>
</plist>
4) XMLProcessor 是我制作的解析器,它从 NSURL 获取 NSData,然后将其转换为字符串,然后我对其进行解析以适应 NSMutableDictionary,这是该类的链接: