PDA

View Full Version : Need help with either java or ajax! please help


radiohotforum
02-16-2009, 03:22 PM
Your my last resort
All I want is to make it ajax refresh every 30 seconds
heres the code I have edited to make the current refresh. I just want it to do a ajax or java refresh

//-- Refresh new posts search every 5 seconds
//-- Add:
if ($search_id == 'newposts')
{
meta_refresh(120, append_sid($phpbb_root_path . 'search.' . $phpEx, array('search_id' => 'newposts')));
}
//-- End Refresh new posts search every 5 seconds




$time_limit = time() - (7 * 86400);
if ($show_results == 'posts')
{
$sql = 'SELECT p.post_id
FROM ' . POSTS_TABLE . ' p
WHERE p.post_time > ' . $time_limit . "
$m_approve_fid_sql
" . ((sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . "
$sql_sort";
$field = 'post_id';
}
else
{
$sql = 'SELECT t.topic_id
FROM ' . TOPICS_TABLE . ' t
WHERE t.topic_last_post_time > ' . $time_limit . '
AND t.topic_moved_id = 0
' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . '
' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . "
$sql_sort";
$field = 'topic_id';
}


if ($search_id == 'newposts')
{
$result = $db->sql_query_limit($sql, 31 - $start, $start);
}
else
{
// only return up to 1000 ids (the last one will be removed later)
$result = $db->sql_query_limit($sql, 1001 - $start, $start);
}


I need to add a ajax refresh where do I add it??

radiohotforum
02-16-2009, 09:10 PM
Bump.. Come on guys. :) please help

Old Pedant
02-17-2009, 02:12 AM
Ummm...you are posting a PHP question in a JSP forum. Why are you surprised you don't get any answers????

As for the Ajax "refresh": I suspect that the answer is "none of the above". You probably need to add it in your JAVASCRIPT code (no, JavaScript has *NOTHING* to do with JSP or Java except for the stolen "Java" in its name). But I don't see any JavaScript code there, so it's hard to guess how you are invoking AJAX in the first place. (AJAX implies JavaScript, but you show none of that.)

Sorry, but I think you are asking in the wrong forum and probably not showing any relevant code, to boot.

My guess would be to ask in a JavaSCRIPT forum *and* show the JavaScript code in your page. You could do that--ignoring the mostly irrelevant PHP code--by doing a VIEW==>>SOURCE while in the browser.

servlet
02-17-2009, 06:08 AM
Reporting to mod.
This thread is in wrong forum, mods need to move it.

WA
02-17-2009, 10:07 AM
Thread continued here (http://www.codingforums.com/showthread.php?t=158921). Also, you should make sure you know the difference between "JavaScript" and "Java". The two are very different, though you refer to Ajax/JavaScript as Java.