Hi there, I hope your appreciated help.
My problem is the output of this xml file with asp.
In this row:
I need this output: 219 - 161 Woman, 58 ManCode:xml = xml & "<description>" & strsum & "-" & strsex & "</description>"
But I have this: 161 - 161 Woman, 58 Man
Can you help me? thank you in advance.
Your help would be very appreciated
Code:<% Set objconn = Server.CreateObject("ADODB.Connection") objconn.Open "DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;DATABASE=xxx;USER=root;PASSWORD=xxx;OPTION=3;" SQL = "SELECT sName FROM `tbl_online` LIMIT 1;" Set objRec = objconn.execute(SQL) SQL = "SELECT SQL_CALC_FOUND_ROWS " SQL = SQL & " COUNT(*) As `sum`, " SQL = SQL & " CASE WHEN Sexo='F' THEN CONCAT(COUNT(*),' ','Woman') " SQL = SQL & " ELSE CONCAT(COUNT(*),' ','Man') END `Sex` " SQL = SQL & " FROM " SQL = SQL & " `tbl_online` " SQL = SQL & " WHERE " SQL = SQL & " 1 " SQL = SQL & " GROUP BY " SQL = SQL & " `Sexo`;" Set rs = Server.CreateObject("ADODB.RecordSet") rs.Open SQL, objconn If not rs.eof then SQL = "SELECT FOUND_ROWS() x;" Set objRs = objconn.execute(SQL) strname = objRec("sName") xml = "<?xml version=""1.0"" encoding=""ISO-8859-1"" ?>" & _ "<rss version=""2.0"">" & _ "<channel>" & _ "<title>Test</title>" & _ "<description>Test</description>" & _ "<link>http://localhost/</link>" & _ "<language>en</language>" xml = xml & "<item>" xml = xml & "<title>Test</title>" Do while not rs.eof strsum = rs("sum") strsex = rs("sex") xml = xml & "<description>" & strsum & "-" & strsex & "</description>" rs.movenext Loop xml = xml & "<link>http://localhost/</link>" xml = xml & "<pubDate>" & now() & "</pubDate>" xml = xml & "</item>" objRs.close set objRs=nothing End if xml = xml & "</channel></rss>" response.ContentType = "text/xml" response.write xml rs.close set rs=nothing set objRec = nothing objconn.Close set objconn=nothing %>



Reply With Quote
Bookmarks