Jump to content

woolyg

Members
  • Posts

    254
  • Joined

  • Last visited

    Never

Everything posted by woolyg

  1. Hi, I'm completely new to this, so please excuse any silliness - I'm starting to look into hosting my site on a dedicated network and have a couple of questions, so if anyone can help that would be great. 1. Is it possible to run a MySQL box, separate from the web server, to handle query processing? 2. If so, is there any noticeable lag in display/performance for the person viewing the site, internal network issues aside? 3. Would this kind of setup cause security issues? 4. Could this be done using 2 windows boxes? Thanks, WoolyG
  2. Hi, Could someone please give me a dig out with the SQL query I need to make? I have a table that goes as follows: ID | name1 | score1 | name2 | score2 | name3 | score3 I need to select info from a line that says "select name(x), where score(x)=1" - eg - if score1='1', return name1 - if score2='1', also return name2 - if score3='1', also return name3 Can anyone help? Thanks, WoolyG
  3. woolyg

    syntax error

    Shouldn't you be using VALUES instead of 'VALUE'?
  4. Hi, Is mysql_close() absolutely necessary? The site I am coding uses quite a lot of mysql queries, all using the once connection, held in a <?php require "db.php"; ?> ..file. For each of the queries that I make from my pages, do you believe I should close off every query after it's finished? Your opinions please! -WoolyG
  5. Ah yes - I'm learning!! Thanks Shang, Woolyg
  6. Hi Shang, I will - what will this do? Does this make it asynchronous instead of synchronous? Thanks, WoolyG
  7. I've found the problem, for anyone who's experiencing this issue - the way I've put my getData() function was incorrect. The following JS will allow for multiple calls be made, and not lost: 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); XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { obj.innerHTML = XMLHttpRequestObject.responseText; delete XMLHttpRequestObject; XMLHttpRequestObject = null; } } XMLHttpRequestObject.send(null); } } ...Solved. Thanks - WoolyG
  8. Hi all, Is it possible to run a javascript without an event handler? What I'd like to do is to update the contents of a text box, as information is parsed into a php file, on the fly. The info to go into the text box depends on values pulled from a mySQL table by the PHP file. An order of something like this: <?php //Mysql query grabs info from a table //Values are assigned to 2 variables //Text box 1 is updated with the value of variable 1, using javascript, automatically //Text box 2 is updated with the value of variable 2, using javascript, automatically //The world becomes a better place ?> Can this be done? Thanks, WoolyG
  9. Hi Shang, I've put together an example of my code for download here http://www.granconz.com/working/ajax.zip (just 3 simple pages - 2kb). If you put them into a folder and open them in IE, and then FF, you'll see what I mean. Here is the actual code I'm using: index.php: <!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>Testing the GET DATA Process</title> <script type="text/javascript"> var XMLHttpRequestObject = false; if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest(); } else if (window.ActiveXObject) { XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP"); } function getData(dataSource, divID) { if(XMLHttpRequestObject) { var obj = document.getElementById(divID); XMLHttpRequestObject.open("GET", dataSource); XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { obj.innerHTML = XMLHttpRequestObject.responseText; } } XMLHttpRequestObject.send(null); } } function pick_scorers(match_id){ getData("firstpage.php?match_id=" + match_id + "&blank=1", 'div_1'); // Get the first set of details and put them into div_1 getData("secondpage.php?match_id=" + match_id, 'div_2'); // Get the second set of details and put them into div_2 } </script> </head> <body> Click on <a href="javascript:pick_scorers('1')">this link</a> to test the script. In FireFox, both of the DIVs below populate OK. In IE, only one of them does. <div id="div_1" name="div_1"></div> <div id="div_2" name="div_2"></div> </body> </html> firstpage.php: <!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> </head> <body> First Page </body> </html> secondpage.php: <!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> </head> <body> Second Page </body> </html>
  10. Hi Shang, Yes, the name and ID entities of the form have been set. I've looked a bit more into it, and it appears that only the very last getData process in the function is taking effect each time - if I switch them around, the different info populates from the last process. The most annoying thing is that I can't properly debug it, as it's working absolutely fine in Firefox! Any ideas? Do AJAX functions disallow multiple getData calls in IE?
  11. Hi all, By clicking on a link, I'm calling the following function: function pick_scorers(match_id, sport_id){ var t1s = document.getElementById('team1_score_' + match_id); var t2s = document.getElementById('team2_score_' + match_id); getData("codebin/play_pick_scorers.php?match_id=" + match_id + "&sport_id=" + sport_id, 'pick_scorers_div_' + match_id); getData("codebin/play_temporary_picks.php?match_id=" + match_id + "&sport_id=" + sport_id + "&blank=1", 'picks_temp_div_' + match_id); } ..which basically calls 2 different PHP pages into 2 DIVs, just below the link. What I'm finding id that in IE7, only the FIRST getData part of the function is called, which means only one div populates. In FF (2.0.0.13) both of the divs become populated! Has anyone out there come across this before? Is there a way to tell IE to follow each & every call to getData within the function? V. Annoying, as I'd like this function to work cross-browser! All help appreciated, WoolyG
  12. Sorry, I picked 30 as an example - these numbers could go up to any number really. I found a nice little function from reading a bit further: function ordinalize($number) { if (in_array(($number % 100),range(11,13))){ return $number.'th'; }else{ switch (($number % 10)) { case 1:return $number.'st'; break; case 2: return $number.'nd'; break; case 3:return $number.'rd'; default:return $number.'th'; break; } } } Thanks for your help! - Woolyg
  13. Hi all, If I print out for($i=1; $i<=30; $i++){ echo $i."<br />"; } Is there an easy way in PHP that I can format $i so that it puts 'st' , 'nd', 'rd', 'th' after it? eg: 1st 2nd 3rd 4th - All input appreciated. Woolyg
  14. Yeah, they're all myISAM - I'm in the middle of attempting it now!
  15. Hi all, In my infinite wisdom and staggering ineptitude, I had a crash and lost all of the info on my testing webserver. I've since reinstalled the webserver, and am about to get into re-integrating my MYSQL files from a backup. I'm running XAMPP on a windows machine, and in the mysql/data folder there are folder entries for the various databases I set up. My question is - Once I have recreated the blank DB of the same name of the original DB, is it OK to simply go and grab the relevant .frm / .MYD / .MYI files from the backup, and copy them to the DB's folder? ... or are there implications of doing that? All info appreciated. Woolyg.
  16. It is! SELECT player_id ,SUM(points) as 'total' FROM game_matches WHERE league_id = 1 GROUP BY player_id ORDER BY total DESC Excellent - thank you so much for your input aschk. Solved.
  17. That's right - The total of all points, per player, for league 1 only. After the GROUP BY part, is it possible for me to ORDER BY 'total'? Thanks, WoolyG
  18. Hi all, I've got a table that logs points assigned to a player, and each player belongs to a league. Please see the image below for the layout: What I want to do is select every player_id from the table, but order them according to the sum total of the points they have accumulated for league_id 1. Can this be done? I've been banging my head off this for days... Thanks, Woolyg
  19. Thanks - I ended up using: <?php $start_day = $_POST['vacancy_start_day']; $start_month = $_POST['vacancy_start_month']; $start_year = $_POST['vacancy_start_year']; $vacancy_start_date = $start_year."-".$start_month."-".$zero.$start_day." "."00:00:00"; $vacancy_end_date = date("Y-m-d H:i:s", strtotime("$vacancy_start_date + 31 days")); ?> - Woolyg
  20. Hi all, I'm taking information from a form that defines a starting time for an advert, as follows: <?php $start_day = $_POST['ad_start_day']; $start_month = $_POST['ad_start_month']; $start_year = $_POST['ad_start_year']; $ad_start_date = $start_year."-".$start_month."-".$zero.$start_day." "."00:00:00"; ?> Now, i'd like to define $ad_end_date to be 31 days after $ad_start_date.. how do I do this? I've looked at mktime() and strtotime() but neither are very clear, and both arent working for me! Cheers, Woolyg
  21. I'll change over the redirection style this evening, thanks for the info. Hopefully it'll work. WoolyG
  22. Hi all, I'm having difficulties with urlencode() - can anyone help? What I'm trying to do is use an HTML refresh on one page (log_me_in.php) to open another (main.php?badlogin=true), but it just won't work for me. Here is the code from log_me_in.php: <!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" /> <?php $str = "true"; $string = urlencode($str); ?> <meta http-equiv="refresh" content="0;URL=main.php?badlogin=<?php echo $string; ?>" /> <title>Bad login - Redirecting...</title> </head> <body> </body> </html> ..and here is the code for main.php: <!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>Main</title> </head> <body> <?php echo $_GET['badlogin']; ?> </body> </html> On main.php, $_GET['badlogin'] is not displaying. I understand (from reading prior issues like this) that with standard characters it shouldn't be necessary to use urlencode() in the first place, but I've been told by my web host that it is necessary to use. Can anyone help? All input appreciated. Woolyg.
  23. OK, COol, thank you for your reply Jos - Woolyg
  24. Hi all, I'm trying to populate a DIV from a PHP page that holds an HTML form, using AJAX. Is this possible? What I'm finding is that the information is called from the remote PHP page populates fine if it's not part of a <form></form> tag, but will not populate if it is part of one. Can anyone help? Cheers, Woolyg
  25. mbeals, Thanks - that worked perfectly. You rock! Now I have an add-on Q: In JS, is there a way to pass a variable into another variable? For example, I'd like to pass variable match_id1 into variable team1_score, below, taking inputs from form items: $match_id = $matches['match_id']; <input type='text' id='$match_id.team1_score' name='team1_score' size='2' maxlength='2' /> var match_id1 = document.getElementById('match_id') var team1_score = document.getElementById([b]'match_id1[/b].team1_score'); Is it possible to do this? The reason I'm trying to do it is to continue passing unique information in through the javascript, so that whenever anyone clicks on the onclick() text, the site displays the result info for each line of the populated table. Any ideas? Thanks for your earlier help. 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.