Jump to content

woolyg

Members
  • Posts

    254
  • Joined

  • Last visited

    Never

Everything posted by woolyg

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script language="JavaScript" type="text/JavaScript"> //XHR for AJAX Functionality function getData(dataSource, divID) { var XMLHttpRequestObject = false; if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest(); } else if (window.ActiveXObject) { XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHttp"); } if(XMLHttpRequestObject) { var obj = document.getElementById(divID); XMLHttpRequestObject.open("GET", dataSource, false); XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { obj.innerHTML = XMLHttpRequestObject.responseText; delete XMLHttpRequestObject; XMLHttpRequestObject = null; } } XMLHttpRequestObject.send(null); } } //Show Report data function show_report_info(job_id){ obj = document.getElementById('job_report_' + job_id); if (obj.style.display == ""){ obj.style.display = "block"; getData("reports.show_full_report.php?job_id=" + job_id, 'job_report_' + job_id); } else if(obj.style.display == "block"){ obj.style.display = 'none'; } else if(obj.style.display == "none"){ obj.style.display = 'block'; getData("reports.show_full_report.php?job_id=" + job_id, 'job_report_' + job_id); } } </script> </head> <body> <table> <tr> <td class='width_twentypercent'><font class='report_job_header'>1.</font> <a href='#' class='report_job_head' onclick=show_report_info('1')>First Job</a> </td> <td class='width_fivepercent'> </td> <td><font class='report_date'>Job Started:</font> <font class='report_date_bold'>1st Sep 2008</font> </td> <td> </td> </tr> <tr> <td colspan='4'><div id='job_report_1'></div></font> </td> </tr> </table> </body> </html> Code in reports.show_full_report.php: <?php $job_id = $_GET['job_id']; echo "<br /><br />$job_id"; ?> ..as mentioned before, it works fine in IE, and used to work fine in FF before reloading. Can you see anything that might be at fault? Thanks for your help so far. WoolyG
  2. Thanks for that. I've upgraded now - on 3.0.1, but the issue remains. Can anyone help or offer any insight? WoolyG
  3. Hi all, I recently re-imaged my PC and reloaded the latest Firefox (2.0.0.16), then installed 'Firebug' to check up on AJAX and JS functionality. The thing is - it appears Firefox isn't working. Using a standard AJAX call, I'm trying to populate data into a DIV (which works fine in IE6 + 7). Firebug says there's no problem, that the relevant PHP file was called OK, so it seems the JS is working OK. But the div isn't populating with the retrieved data. Has anyone else had this problem? Is there an easy fix? This was working fine on FF before, but once I reloaded FF, it stopped functioning.... Anyone? WoolyG
  4. Ah nice one - I've kinda taken what you're saying & done the following: <?php while($display_players = mysql_fetch_assoc($run_players)){ $players _id = $display_players[player_id']; $players _datetime = $display_players['date_joined']; $players _date = substr($players_datetime, 0, 10); if($cur_date == $players_date){ } else { echo "<br/><br/>$players_date<br/>"; } echo "players ID: ".$players_id."<br />"; $cur_date = substr($players_datetime, 0, 10); } ?> Thanks for your help WoolyG
  5. Hi, I'm trying to reference an item in an already-passed section of a while loop. The idea is to group items by date, and display the date for that group, but if the date for a line is the same as the line directly previous to it, then don't output the date for that line, effectively creating the display below as an example: Example: DATE ID - Firstname - Lastname eg: Thursday 14th August 2008 1 - John - Smith 2 - Dee - Brady I'm using: <?php $get_players = " SELECT players.player_id, players.date_joined, players.firstname, players.lastname FROM players "; $run_players = mysql_query($get_players); $num_players = mysql_num_rows($run_players); while($display_players= mysql_fetch_assoc($run_players)){ $player_id = $display_players['player_id']; $date_joined = $display_players['date_joined']; $firstname = $display_players['firstname']; $lastname = $display_players['lastname']; echo $date_joined."<br />"; echo $player_id." - ".$firstname." - ".$lastname."<br /><br />"; } ?> ..but where it says <?php echo $date_joined."<br />"; ?> I'd like to run <?php if($date_joined == **SAME VALUE OF PREVIOUS INSTANCE OF LOOP**){ //Do Nothing } else { echo $date_joined."<br />"; } ?> Can anyone help? I hope this is clear enough.. WoolyG
  6. Great stuff everyone, thanks a million for your input - The Little Guy wins by a nose! Solved thanks - WoolyG
  7. Hmm, no joy there, I'm getting "Parse error: syntax error, unexpected ';' in C:\Program Files\xampp\htdocs\paw\str.php on line 3"
  8. That's the clincher though, I should have mentioned it - the string between the brackets could be any length.. any ideas? WoolyG
  9. Hi all, Is there a way to locate a string within a string that is definitely located between a set of characters? $str = "My Name is (WOOLYG)"; ..basically, I want to capture all of the characters between the brackets. Is this easily done? Thanks, WoolyG
  10. Thanks Barand, I'll get reading into it! - WoolyG
  11. Thanks for that - I don't fully understand how it works, but it does.. What if I wanted to output 6(Player6), 7(Player7), 8(Player8), 9(Player9), 10(Player10) ..is that possible? Thanks, WoolyG
  12. I'm sorry, the brainfreeze is obviously affecting my communication too.. I'm using: SELECT players.player_id FROM players ORDER BY players.player_id DESC LIMIT 5 ..but that's outputting 10,9,8,7,6 ..and I'd *like* to output 6,7,8,9,10 (where 10 is the very highest player_id) Do you get me? sorry for the confusion... W
  13. Hi, I'm having a brainfreeze, could someone help? CREATE TABLE IF NOT EXISTS `players` ( `player_id` int(11) unsigned NOT NULL auto_increment, `player_name` varchar(64) collate latin1_general_ci NOT NULL, PRIMARY KEY (`player_id`), FULLTEXT KEY `player_name` (`player_name`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; INSERT INTO `soccer_players` VALUES (1, 'Player1'); INSERT INTO `soccer_players` VALUES (2, 'Player2'); INSERT INTO `soccer_players` VALUES (3, 'Player3'); INSERT INTO `soccer_players` VALUES (4, 'Player4'); INSERT INTO `soccer_players` VALUES (5, 'Player5'); INSERT INTO `soccer_players` VALUES (6, 'Player6'); INSERT INTO `soccer_players` VALUES (7, 'Player7'); INSERT INTO `soccer_players` VALUES (8, 'Player8'); INSERT INTO `soccer_players` VALUES (9, 'Player9'); INSERT INTO `soccer_players` VALUES (10, 'Player10'); I'm trying to select 5 player_id, ordered by player_id DESC, then output them as follows: 5 - 6 - 7 - 8 - 9 - 10 Can anyone help? Thanks, WoolyG
  14. MadTechie, I bow before you. Works like a charm - thanks! WoolyG
  15. Hey, thanks for that. That works from one instance of <item>, but if I place more than one <item> instance into the XML, then the <article:uid> from the first <item> instance is echoed throughout the page, effectively giving: 1347132 - Headline here (Item 1) 1347132 - Second Headline (Item 2) .. and I'd like each UID to relate to the <item> it's contained inside.. do you get me? Thanks for your input thus far, any ideas? WoolyG
  16. Hi, Could someone maybe point out how I would do this? I'm trying to display the article:uid from the following XML string: <item> <title><![CDATA[Headline here]]></title> <link>http://www.ext_site.com/page/Headlines/0,,12306~1347132,00.html</link> <pubDate> Sat, 19 Jul 2008 10:50:00 +0100 </pubDate> <description><![CDATA[Description goes here]]></description> <article:uid>1347132</article:uid> </item> I'm using: <?php foreach ($xml->xpath('//item') as $item) { $title = $item->title; $description = $item->description; $guid = $item->xpath('//article:uid'); echo "<a href='$link'>".$guid." - ".$title."</a><br />".$description."<br />"; } ?> .. but the guid isn't displaying, it's only saying "Array" - can anyone help me on how to extract the 'article:uid' from the string? All help appreciated, Thanks - WoolyG
  17. OK - thanks for the reply. I've ascertained that the server is definitely using PHP5, and these functions should work. From an online tutorial, I'm using the following code (you should be able to copy it and place it into any PHP file on a live server and run it: <?php # INSTANTIATE CURL. $curl = curl_init(); # CURL SETTINGS. curl_setopt($curl, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/122933.rss"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0); # GRAB THE XML FILE. $xmlTwitter = curl_exec($curl); //echo $xmlTwitter; curl_close($curl); # SET UP XML OBJECT. $xmlObjTwitter = simplexml_load_string( $xmlTwitter ); $tempCounter = 0; foreach ( $xmlObjTwitter -> item as $item ) { # DISPLAY ONLY 10 ITEMS. if ( $tempCounter < 11 ) { echo "<li><a href=\"{$item -> guid}\">{$item -> title}</a></li> "; } $tempCounter += 1; } ?> - which should show the RSS feed on my page. If I un-comment "echo $xmlTwitter;" , it displays all of the XML data - but I can't select any of it to display using # SET UP XML OBJECT. $xmlObjTwitter = simplexml_load_string( $xmlTwitter ); Can anyone shed some light on why $xmlObjTwitter won't work? Thanks, WoolyG
  18. Hi, I'm trying to bring an RSS feed from another site onto mine, and am trying to use the simplexml_load_file() function to do so. The below code returns the exit('Failed to open xml.') bit - can anyone see what I'm doing wrong here? <?php if (file_exists('http://www.OTHER_SITE.com/rss/ptv/page/ArticleIndex/0,,12306~2233528,00.xml')) { $xml = simplexml_load_file('http://www.OTHER_SITE.com/rss/ptv/page/ArticleIndex/0,,12306~2233528,00.xml'); print_r($xml); } else { exit('Failed to open xml.'); } ?> Can anyone point me in the right direction? Thanks, WoolyG
  19. OK, thanks for that - WoolyG
  20. I'm trying to invalidate an entry that uses numerals and any of the characters D/W/L. Would this work, below? <?php if( (preg_match('|^[WLD]+$|', $input)) && (preg_match('|^[WLD]+$|', $input)) ) { // Invalidate $input } ?> .. is the code above ok? That is, if $input had number(s) in its string, and had W/L/D in its string, it's invalid? Cheers, WoolyG
  21. An addition to my query: Say if I wanted to invalidate $input if preg_match had BOTH numerals and characters (W/L/D) in it, how would I go about that? Cheers, WoolyG
  22. That's great, thanks. There'll always be at least 1 character being entered, so I'll use what you printed! Nice one, thanks again - WoolyG
  23. Hi all, I'm looking to disallow all characters except the following from a form's text field: 1 2 3 4 5 6 7 8 9 0 W L D Can anyone help me with the preg_match? WoolyG
  24. Hi, I have a page that is dynamically created, and at any given time there could be any number of DIVs set to display = "block"; I need to incorporate a script that, upon clicking a link say, closes all open DIVs. Each DIV is uniquely named. Has anyone ever done something like this before? - WoolyG
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.