open($filename, ZIPARCHIVE::CREATE)!==TRUE) { exit("cannot open <$filename>\n"); } $q = "SELECT * FROM images WHERE resourceID=".$rid; $ret = $kdb->query($q); $num = mysql_num_rows($ret); $res = mysql_fetch_array($ret); $zip->addFromString("data.xml" . time(), "XMLXMLXML"); $zip->close(); mysql_free_result($ret); readfile($filename); ?>