Results 1 to 2 of 2
May 24, 2005, 12:50 #1
- Join Date
- Nov 2004
- 0 Post(s)
- 0 Thread(s)
Not showing newsletter section if db is empty
I have a newsletter form with 8 article sections. The resulting newsletter displays the sections in a specific format. However, if the user only has 6 articles, how can I prevent section 7 and 8 from being dispalyed as blank sections?
May 24, 2005, 14:16 #2
Perhaps you could show us the code you are using to display the newsletter as it would help us to give you an answer.
There are ways of not showing recordsets, such as:
DB_CONNECTIONSTRING = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & Server.MapPath("/db/database.mdb") Set objConn = Server.CreateObject("ADODB.Connection") objconn.open DB_CONNECTIONSTRING set objrs=Server.CreateObject("ADODB.Recordset") SQL="SELECT * FROM newsletter ORDER BY sectionid asc" set objrs=objconn.execute(SQL) if not objrs.BOF and not objrs.EOF then i=1 'set i to be a variable so we can use section numbers such as section1, section2 etc... do while not objrs.EOF if objrs("section"&i) <> "" then response.write ("section"&i) &"<br />" & vbcrlf end if i=i+1 objrs.movenext loop objrs.close end if 'bof and eof set objrs=nothing objconn.close : set objconn=nothing
To be honest, unless you give us more detail on your specific problem then it's going to be hard to help.Sitenetics - Lending webmasters a helping hand