Jump to content

woolyg

Members
  • Posts

    254
  • Joined

  • Last visited

    Never

Everything posted by woolyg

  1. Hi, I hope I explain this one clearly. I am running a PHP script that outputs the lines of a mySQL table to an HTML table. Kinda like: <table> while($matches = mysql_fetch_assoc($sqlrun)){ $match_id = $matches['match_id']; $team1_id = $matches['team1_id']; $team2_id = $matches['team2_id']; echo "<tr><td><input type="text" id="match_id" value="$match_id"><td><td>$team1_id</td><td>$team2_id</td></tr>\n"; } </table> On each line, I'd like to add the following: <td onclick='getScorers()'><u>Add Scorers</u></td> Now, 'getScorers()' basically uses AJAX to open information in another DIV, using $match_id as its getElementById. As follows: function getScorers(){ var match_id = document.getElementById('match_id'); getData("../../codebin/soccer_get_scorers.php?match_id=" + match_id.value, 'scorersDiv') } OK - my problem here is, that when there are multiple lines within the main output table, there will be links to add scorers on the right hand side of each line, calling the JS. Each time the JS is called, though, it always calls the same Element ('match_id'), as you can see from my coding above. Is there a way to populate my output table and getScorers(), so that each line can call getScorers(), using a unique getElementById string? My current way only calls one element ('match_id'), but in reality there could be tens or hundreds of lines, each wanting to get info to that match.... All help appreciated, Woolyg.
  2. Hi all, another $_SESSION question from me - if I had <?php $number = "2"; ?> is it possible to set $_SESSION['account_$number'] = 'true' ... and would that effectively create $_SESSION['account_2'] = 'true' ?? Woolyg.
  3. Cool, thanks Corbin! That clears things up in my mind. Cheers, Woolyg
  4. Hi all, is there a maximum allowed number of session variables PHP / a PHP server can handle? This is more of a reference question for my own records - say if I had 1,000 users logged in and each had loads of session variables assigned to their session, is there any point where they might start failing? Woolyg.
  5. ..perhaps a silly question, but is it possible? For example, in an AJAX set, have on onclick() event that makes a div drop down, AND populate that same dive from an AJAX-style request? Any help appreciated, Woolyg
  6. Hi all, I have a piece of code in a file called sajax.php: if(!A && typeof XMLHttpRequest != "undefined") It all works fine, but when I go about debugging and attempting to make the page XHTML-compliant, the '&&' bit gets caught out. If I replace them with & in each case, the PHP document ceases to function, so I have to revert back to '&&' to get it going again. I have added the following to my php.ini file on the server: arg_separator.output = "&" arg_separator.input = "&" ..but it makes no difference. Is there a different way of escaping ampersands so the XHTML inspector will allow them, and for my AJAX to still work? All help much appreciated. WoolyG
  7. Hi all, my first post here - hope someone can help. I'm trying to put together an AJAX-based form validation (still learning) and I'm stuck trying to get the form to tell the user when their passwords do not match. Everything else on the form uses AJAX to validate the input, but I just can't get the program to check when password1 != password2. Heres my main code (please assume that my connections to DB and other ajax xhr requests work fine otherwise, and my styles.CSS holds div ID info) - is there a problem with my javascripting? <?php require "../inc/session.php"; // Include the Sajax library include "../inc/Sajax2.php"; // Function to check if passwords match function check_passwordsmatch() { $password1 = mysql_escape_string($password1); $password2 = mysql_escape_string($password2); if ($password1 != $password2){ // PW not OK return array('no'); } // PW OK return array('yes'); } ?> <!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>Sign Up!</title> <script type="text/javascript"> <?php sajax_show_javascript(); ?> function check_passwordsmatch(result) { if(result[0] == 'yes') { document.getElementById('pw_no_match').style.display = 'none'; document.getElementById('pw_match').style.display = 'block'; } if(result[0] == 'no') { document.getElementById('pw_match').style.display = 'none'; document.getElementById('pw_no_match').style.display = 'block'; var str = 'The passwords you have entered do not match. please try again.'; document.getElementById('pw_no_match').innerHTML = str; } } function passwordsmatch() { var password1 = document.getElementById('password1').value; var password2 = document.getElementById('password2').value; x_passwordsmatch(password1, password2, check_passwordsmatch); } </script> <link href="../inc/styles.css" rel="stylesheet" type="text/css" /> </head> <body> <table class="signup"> <tr> <td class="signupleft">Password:</td><td class="signupright"><input type="text" name="password1" id="password1" size="20" maxlength="32" class="boxes" /></td> </tr> <tr> <td class="signupleft">Verify Password:</td><td class="signupright"><input type="text" name="password2" id="password2" size="20" maxlength="32" class="boxes" onBlur="check_passwordsmatch(); return false;" /><div id="pw_no_match">no</div><div id="pw_match">yes</div></td> </tr> </table> </body> </html> All help appreciated. Woolyg.
  8. Yeah - I've seen that alright - but the server I'm using seems to only append &PHPSESSID=[whatever] to a URL if I haven't specified the exact url yet, and left it blank (eg. <a href=''>Link</a>). In formed links, it seems ok - but I'll definitely keep an eye out for it. Can any of you guys think of any other problems with XHTML validation? This is all helping muchly.
  9. Ahh... ok:) Thanks for that! Woolyg
  10. So if I have arg_separator.output = "&" ..in my php.ini file, and continue the structure my links as: <a href='date.php?day=$day&month=$month... Then the validator will accept the link as valid?
  11. AndyB, How do you mean 'defining the separator_output as &' ? Thanks
  12. I'm TERRIFIED of big ships. When I see one, I have an overpowering need to drop to my hands & knees. When someone puts a towel in their mouth, it makes me wanna vomit. In fact, just writing it makes me wanna vomit. I pick my nails to the point that they practically don't exist. If I am in the middle of a coding project, I turn into a complete zombie, much to the annoyance of my girlfriend. Just general zombie-like behaviour, nothing too out there - unresponsive to general conversation, motor functions slower than normal, flesh-eating tendencies.. you know how it goes. (Not so much an obsession than an allergy) - if I manage to ingest calamari, my head swells up like a big purple football and I look like I've been very badly beaten up. Quite the catch, me. Quite the catch. ..if I hadn't taken the coding job on that massive calamari fishing ship where the only food is towels, I wouldn't be *half* as interesting as I am today.
  13. Obsidian, Congratulations on your compliance Thats a great help - I was worried that the markup output by ECHO statements and various PHP jiggerypokery might affect the compliance, but now I know that careful construction will aid validation. If I use includes on my page, I need to ensure they are validated also, is that correct? I am trying to bring in modules to each page so that sections can be coded separately.. WoolyG
  14. Hi all, I thought I'd post this as a discussion/commentary rather than a help request, as I'm just getting in to learning about it. I've been piecing together PHP and CSS of late, coming from a dumdum HTML background, and have had an idea for a site that I think will work pretty well, so I am working on a good, XHTML/CSS compliant PHP site that can be viewed & used without issue across all browsers & platforms. Have any of you had any major headaches in successfully validating PHP-infused XHTML/CSS pages? Is it actually possible to do? - Am I barking up the wrong tree..? Are there any major pitfalls to look out for? All discussion / comments are much appreciated. Cheers,
  15. Think I've cracked it. The issues with the includes were actually problems with the includes INSIDE the included files (if that makes sense). I put in absolute paths for them and all worked ... so far! Solved
  16. The painful thing is, that if I add an INC folder to my www/accounts folder, the linking works... but I don't wanna have to add the INC folder to every added folder on the site!!!! Wah!
  17. I've tried those combinations, but no joy. Can anyone shed some light please? Any help appreciated..it's saying ..No such file or directory in /home/myact/public_html/mysite/accounts/signup.php on line 2 Woolyg
  18. Hi all, Pretty sure this has been asked before, but I can't find conclusive help on it. I've got a file structure -www (containing normal site files) -www/inc (containing includes like db.php, session.php etc) -www/accounts (containing an area for customer login) I'm working on www/accounts/signup.php and am trying to use the following code: <?php include "/inc/session.php"; ?> ...so that certain session elements can be set. however, I'm getting an error Warning: include(/inc/session.php) [function.include]: failed to open stream: No such file or directory in E:\XAMPP\xampp\htdocs\mysite\accounts\signup.php on line 3 (I'm using Xampp as a testing server as well as my live server) - I've tried various combo's of paths to the sessions file, but the server is not allowing a proper include to it. How can I fix this? Thanks, Woolyg
  19. Nice one, I'll get this going and try to achieve it. Thanks for your help guys. Woolyg
  20. Is there a way to do it in PHP? I just need to run a quick function using TIMESTAMP as opposed to DATETIME..
  21. Hi all, Safe in the knowledge that TIMESTAMP format is DATETIME's ugly older sister, if I have a DATETIME string (2007-10-25 02:42:52) that I need to switch to TIMESTAMP. Maybe I'm into ugly old chicks, who knows. Can anyone help? Cheers, WoolyG
  22. Say if the info in a field is delimited by a comma, I want to find a way to count the commas. Something like this text_field --------- hello,my,name,is,woolyg, SELECT COUNT(REPLACE(text_field,' ','')) AS number from table If I can count the commas between the text, I can order the full table results by it... so you get me? - Woolyg
  23. Thanks for that. Now, if I wanted to create a mysql query that ordered the results based on the number of items in a field, is this possible? Something along the lines of this (I know it's wrong, but...) SELECT * FROM table ORDER BY count(explode(", ",table.text)) DESC LIMIT 1 - Woolyg
  24. Hi, If I have data I wish to explode, say $text = 'hi, there, everyone, ..., .., ......'; $arr = explode(", ",$text) How do I find out how many items are in the exploded array, if I do not know how many items are in the imploded $text variable? All help appreciated, 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.