DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: DB Query in IE vs. Firefox

  1. #1
    Join Date
    Aug 2007

    DB Query in IE vs. Firefox

    Hi Folks,

    I've encountered a problem where I can run sequential calls to my database in FF and have the expected result. I've got a Country drop-down menu which, depending on the country the user selects a Province/State drop-down menu will be appropriately updated.

    In FF this works well. In IE it does not. It will make the initial query but it won't perform subsequent queries. One person I worked with suggests that perhaps these things are cached and I'd have to clear the cache programatically.

    The question of course is can anyone suggest to me a way to get this working in IE?


  2. #2
    Join Date
    Aug 2007
    OK, an update to my problem is I've managed to find a way to get around the caching problem ( My code looks like this:
    			countrySel = createSelect( "countrySel", countries,  anchorTop + lineDist*3, anchorTF, 80 );
    			countrySel.onchange = 
    				new Function( " 'GET', 'getProvinces.php?country=' + this.value + '&variance=' + new Date().getTime() ); ajaxProvince.send( null );" );
    			profileForm.appendChild( countrySel );
    	ajaxProvince.onreadystatechange = function()
    alert('here'); // Debug msg
    		if(ajaxProvince.readyState == 4)
    			provState = new Array();
    			var provArr = ajaxProvince.responseText.split( '|' );
    			for( var i = 1; i < provArr.length; i++ )
    				provState.push( provArr[i] );
    			fs_store.removeChild( provStateSel );
    			if( browser == 'IE' )
    				provStateSel = createSelect( "provStateSel", provState, lineDist * 3 + 24, 310, 90 );
    				provStateSel = createSelect( "provStateSel", provState, lineDist * 3 + 10, 310, 90 );
    			fs_store.appendChild( provStateSel );	
    Again, in FF this works but IE still gives me grief.
    Last edited by Hack; 10-22-2007 at 01:56 PM. Reason: Added Code Tags

  3. #3
    Join Date
    Aug 2007
    Hi folks,

    To continue my updates I managed to defeat one problem, that is the using one DDM to spawn the contents of another. Essentially I had to re-create my AJAX object each time I made a new selection. I couldn't find a slicker way of doing this but it works.

    However, in the spirit of dev work with IE I fixed one problem only to encounter another. I want to a) select a country which then b) spawns the DDM of provinces/states which, when selected will produce c) a DDM of time zones.

    My database tables are as follows:

    TimeZone: text, code
    RegionTimeZone: code, province/state (code is FK of TimeZone)

    When I query the database I have to use a nested SELECT statement as follows:

    SELECT text FROM TimeZone WHERE code = (SELECT code FROM RegionTimeZone WHERE province_state = xxx);

    This can potentially cause problems b/c the second select statement can return multiple rows. To get around this I broke it into two statements so I get the codes first and then in my program I run a loop which then calls the first select statement above on each of those codes to get the text.

    Here are the two functions that drive this:
    var ajaxTimeZones;
    var ajaxTimeZoneText;
    function timeZonesTextFunc( timeZone )
    	ajaxTimeZoneText = ajaxInit();
    	ajaxTimeZoneText.onreadystatechange = function()
    		if( ajaxTimeZoneText.readyState == 4 )
    			var timeZoneText = ajaxTimeZoneText.responseText;
    			fs_store.removeChild( timeZoneSel );
    			timeZones.push( timeZoneText );
    			if( browser == 'IE' )
    				timeZoneSel = createSelect( "timeZoneSel", timeZones, lineDist * 4 + 24, 310, 90 );
    				timeZoneSel = createSelect( "timeZoneSel", timeZones, lineDist * 4 + 10, 310, 90 );
    			if( timeZones.length == 1 )
    				timeZoneSel.disabled = true; 
    			fs_store.appendChild( timeZoneSel );
    	} 'GET', 'getTimeZoneText.php?code=' + timeZone + "&variance=" + new Date().getTime() ); 
    	ajaxTimeZoneText.send( null );
    function timeZoneFunc()
    	ajaxTimeZones = ajaxInit();
    	ajaxTimeZones.onreadystatechange = function()
    		if( ajaxTimeZones.readyState == 4 )
    			var timeZonesArr = ajaxTimeZones.responseText.split( '|' );
    			timeZones = new Array();
    			for( var i = 0; i < timeZonesArr.length - 1; i++ )
    alert( 'debug' );
    				timeZonesTextFunc( timeZonesArr[i] );
    In FF this works just fine but in IE if I remove the "alert( 'debug' );" I get the last time zone text.

    I've tried to put a while loop in place of the debug statement just to see if it's the timing but alas it didn't work.

    The obvious questions are; why does this work when I put in the alert box and how can I make it work without the box?

    Last edited by Hack; 10-25-2007 at 01:53 PM. Reason: Added Code Tags

Similar Threads

  1. QUERY: IE vs Firefox
    By dhruba.bandopad in forum VB Classic
    Replies: 2
    Last Post: 06-26-2006, 12:07 PM
  2. SQL2000 remote SQL query
    By lightningtechie in forum Database
    Replies: 1
    Last Post: 02-07-2006, 09:34 AM
  3. Multi-table Select Query using Joins
    By knightsg in forum Database
    Replies: 0
    Last Post: 02-16-2005, 09:07 AM
  4. count distinct....query
    By Mohan Ekambaram in forum Database
    Replies: 0
    Last Post: 12-09-2001, 12:56 PM
  5. reg....count distinct query
    By Mohan Ekambaram in forum Database
    Replies: 0
    Last Post: 12-09-2001, 12:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center