Link to home
Start Free TrialLog in
Avatar of fun_g
fun_gFlag for United States of America

asked on

AJAX refresh works outside DIV but not inside. Is there a way to fix this.

I have a tab that successfully updates via AJAX when selecting a date from an array query placed in a separate div. This works perfectly for supplying a drop-down populated with the dates in the field 'cb_dldate1' but now i am trying to write the AJAX target for refreshing the data connected to the date field (cb_dldate1) and the queries are totally different. Somehow developer changed the method for calling fields from the data base and the date database query is not populating the drop down. All other information is refreshed perfectly. I will supply any code needed to better understand this.

Below is the active code that works and then the code that does not.

Please help me find out how to call more that one array in the second method that currently is not working.

Thank you all for your time,
gorg

///CODE THAT WORKS///
 
$query = "SELECT d.cf_user_id, d.recordtime, d.trscore, d.cb_dldate1, d.cb_dltext2, d.cb_dltext3,d.cb_dltext4, d.cb_dlselect2, d.cb_dlselect6, d.cb_dlselect3, d.cb_dlselect5, d.cb_dlselect7, d.cb_dlselect9, d.cb_dlselect8, d.cb_dltext5, d.cb_dltext6, d.cb_dltext7, d.cb_dltext8, d.cb_dltext9, d.text_2, d.cb_dltext10, d.ipaddress, d.cf_id, u.email, u.username , u.gid , u.id AS userid FROM #__daily_logging AS d, #__users AS u WHERE u.id = $user->id AND d.cf_user_id = $user->id ORDER BY d.cb_dldate1 DESC";
 
$_CB_database->setQuery($query);
 
$results = $_CB_database->loadObjectList();	
	
$query = 	"SELECT
cf_id, text_3, text_4, text_7, text_5, text_8
FROM #__committo42_dietsheet
WHERE cf_user_id = $user->id AND date_1 = '" . $results[0]->cb_dldate1 ."'
ORDER BY CAST(text_4 AS DATETIME) DESC";
		
$_CB_database->setQuery($query);
$dietsheet = null;
$dietsheets = $_CB_database->loadObjectList($dietsheet);
 
 
/// CODE THAT DOES NOT WORK  ///
 
$query = "SELECT d.cf_user_id, d.recordtime, d.trscore, d.cb_dldate1, d.cb_dltext2, d.cb_dltext3,d.cb_dltext4, d.cb_dlselect2, d.cb_dlselect6, d.cb_dlselect3, d.cb_dlselect5, d.cb_dlselect7, d.cb_dlselect9, d.cb_dlselect8, d.cb_dltext5, d.cb_dltext6, d.cb_dltext7, d.cb_dltext8, d.cb_dltext9, d.text_2 FROM jos_daily_logging AS d WHERE d.cf_user_id = '$user_id' ORDER BY d.cb_dldate1 DESC";
 
$rowSet = MYSQL_QUERY($query);
	while($row = mysql_fetch_object($rowSet)) {
		if ($row->cb_dldate1 == $date) {
			$result = $row;
		}
  }
 
$query = 	"SELECT 
		cf_id, text_3, text_4, text_7, text_5, text_8 
		FROM jos_committo42_dietsheet 
		WHERE cf_user_id = '$user_id' AND date_1 = '$date' ORDER BY text_4";
 
	$rowSet = MYSQL_QUERY($query);
 
	// Storing dietsheets to array.
	$i = 0;
	while($row = mysql_fetch_object($rowSet)) {
		$dietsheets[$i] = $row;
		$i++;
	}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of cdaugustin
cdaugustin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial