View Single Post
  #5   Spotlight this post!  
Unread 27-03-2003, 15:13
gliebowitz gliebowitz is offline
Registered User
#0075 (RoboRaiders)
 
Join Date: Feb 2003
Location: Hillsborough
Posts: 26
gliebowitz is an unknown quantity at this point
Send a message via AIM to gliebowitz
Cool


A connection is made to an Access db just like you would do for any other ODBC connection. The server we're using is a 1.4 Ghz P3 Dell, so it doesn't seem to get bogged down too often ;-).

If you are interested, this is the code to the asp script requested by the Flash intro to get the latest news:

PHP Code:
var months = new Array ("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
var 
monthValue = new Array (13,14,15,16,17,18,19,20,21,22,23,24);
var 
now = new Date();
var 
month now.getMonth();
var 
date now.getDate();
var 
day now.getDay();
var 
year now.getYear();
var 
week 1;
if (
year 2000year year 1900;
var 
monarr = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if (((
year == 0) && (year 100 != 0)) || (year 400 == 0)) monarr[1] = 29;
sday day;
while (
date != 0){
date --;
sday --;
    if (
sday 0){
        
sday sday 7;
        
week ++;
    }
}
var 
currentMonth months[month]
var 
currentWeek week
var current_category monthValue[month]
var 
out
sql 
"SELECT * FROM data where data_category = " current_category " order by data_subcategory, data_name";
rs Server.CreateObject("ADODB.RecordSet");
rs.Open (sqlConn2,3);
if (
rs.EOF){     // check to see if rs is empty
out += ('    <button name="No articles">\n')
out += ('        <info>There are no new events for this week.</info>\n')
out += ('    </button>\n')
}
else{            
// rs not empty

    
temp_subcat""//this string used to group records by subcategory
    
fields = new Object(); // this object used to store fields in records

while (! (rs.EOF)){

    
// clean up data and put it into the fields object:
    
for ( field_number 0field_number rs.fields.count field_number++ )
        {
        
temp_field String(rs.fields(field_number).Name);
        
temp_content String(rs.fields.item(temp_field));
        
temp_content temp_content.replace(/&#039;/g,"'");
        
if (temp_field.search(/date/) > )     // check for date fields
            
{temp_content slash_date(temp_content);} 
        else if (
temp_content == "null") {temp_content ""; }
        
fields[temp_field] = temp_content
        
// end looping through fields in current record

        // subcategories: when we get to a new one, display it
        
if (temp_subcat != fields.data_subcategory){
            
temp_subcat fields.data_subcategory;
        }
if (
temp_subcat == currentWeek){
            
out += ('   <data>\n')
            
out += ('    <name>'+fields.data_name+'</name>\n')
            
out += ('    <info>'+fields.data_url+'</info>\n')
            
out += ('    <id>'+fields.data_uid+'</id>\n')
            
out += ('   </data>\n')
        } else {
}

        
rs.move(1);
        } 
// end while recordset
     // end else (rs not empty)
rs.Close ();
}
if (
out==""){
            
out += ('   <data>\n')
            
out += ('    <name>No articles.</name>\n')
            
out += ('    <info>There are no new events for this week.</info>\n')
            
out += ('    <id>undefined</id>\n')
            
out += ('   </data>\n')
}
Response.Write(out)
Conn.Close (); 
__________________
Greg Liebowitz
Programmer/Webmaster
Team 75 - RoboRaiders
www.itmediaco.com

http://www.roboraiders.com