?
Solved

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

Posted on 2009-05-02
1
Medium Priority
?
342 Views
Last Modified: 2012-05-06
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

0
Comment
Question by:fun_g
1 Comment
 
LVL 5

Accepted Solution

by:
cdaugustin earned 2000 total points
ID: 24293579
hi,

The whole script seems fairly complex (not just the bit which I can see here) I am sugesting calling this specific script from the browser (using the params the ajax call is sending) and somewhere at the top of the page put error_reporting(E_ALL); and after each query do a echo $query; to see if the script fully executes and to see what queries it tries to execute. If you get the queries take them and copy/paste them directly in the db engine and see if they return the correct data. If thats the case  and if the output of your script matches the one expected, than maybe you have a JS error in the page (check if one appears when you chage tabs)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question