Jump to content

stephenk

Members
  • Posts

    62
  • Joined

  • Last visited

    Never

Everything posted by stephenk

  1. Excellent, thanks very much, now working! Stephen
  2. I have the following very basic code, however it keeps alerting "0" as the table row count, despite the fact I have a properly formed table in the body. function count() { var myTR = document.getElementsByTagName('tr'); alert(myTR.length); } count(); Full code as follows: <!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> <script language="javascript"> function count() { var myTR = document.getElementsByTagName('tr'); alert(myTR.length); } count(); </script> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <table width="200" border="1"> <tr> <td>f</td> <td>f</td> <td>f</td> <td>f</td> <td>f</td> </tr> <tr> <td>ef</td> <td>ef</td> <td>ewf</td> <td>ewf</td> <td>ff</td> </tr> <tr> <td>e</td> <td>e</td> <td>e</td> <td>te</td> <td>tew</td> </tr> </table> </body> </html> Any help greatly appreciated, Stephen
  3. Yeah, well spotted, I usually do that, but the code I quickly wrote out was just for simplicity, not code from my script Thanks for that, good idea, however because of the nature of ereg, it obviously won't always be suitable! Likewise with GingerRobot's solution. I just assumed that there would be some sort of way to do it when not using numbers (which I just used as an example). Cheers, Stephen
  4. I've worked out the eregi one, it can be done using: <?php if(eregi("(abc|bcd|cde)",$1) {} else {} ?> Anyone got any ideas for the if statement?
  5. I had this problem recently. It gets really messy, but here is my solution ... <?php // $filter_age is the value taken from the database, instead of age ranges, you have fruits. <select name="filter_age"> <option value="-">All</option> <option value="2-5"<?php if($filter_age == "2-5") {echo ' selected = "selected"';}?>>2-5</option> <option value="6-12"<?php if($filter_age == "6-12") {echo ' selected = "selected"';}?>>6-12</option> <option value="13-15"<?php if($filter_age == "13-15") {echo ' selected = "selected"';}?>>13-15</option> <option value="16-25"<?php if($filter_age == "16-25") {echo ' selected = "selected"';}?>>16-25</option> <option value="26-39"<?php if($filter_age == "26-39") {echo ' selected = "selected"';}?>>26-39</option> <option value="40-59"<?php if($filter_age == "40-59") {echo ' selected = "selected"';}?>>40-59</option> <option value="60-100"<?php if($filter_age == "60-100") {echo ' selected = "selected"';}?>>60+</option> </select> ?> I built this up quite gradually, but I realised after writiting this code that a much neater solution would be to place all the ages (fruits) in an array, then loop through the array and check if the value from the array matches the value from the database. If so, echo "selected = 'selected'. Stephen
  6. Hi, I know there is a sortcut to do the following, but I cannot find it anywhere. <?php if($a = "1" or $a = "2" or $a="3") {} else {} ?> likewise ... <?php if(eregi("abc", $1) or eregi("bcd",$1) or eregi("cde",$1)) {} else {} ?> I think it involves square brackets and the | symbol, but I can't get the combination right! Many thanks, Stephen
  7. I have now spotted the problem, and yeah, its to do with register_globals. It's because I'm using a POST HTML name the same as a variable name, just for convenience within the script. What a nightmare. Thanks for helping me find the problem. Stephen
  8. Nope, no sessions or cookies. I closed the firefox tab and re-opened. Now it's back to normal. However I don't think that doing that would have cleared the session cookie, even if it was set. It seems so strange!
  9. They are, yeah. I thought register_globals only meant anything when using $variable instead of $_GET['variable']? When I run the script saying $variable="" ..., then run a script saying echo $variable it still returns the contents from ages ago. :S Stephen
  10. I have been working on a script and it worked perfectly on my local server. However when I uploaded it I had problems due to a few variables acting strangely. Eventually i deleted all the script's contents and entered this: <?php echo $variable; ?> and I found that, when uploaded and ran, it returned the contents that I had set when running the full script earlier. I have now gone to the point of declaring all variables for the script using $variable=""; ... etc at the start. Has anyone had experience of this happening before? It took me about 30 mins to finally debug what was happening! Stephen Edit: sorry, just realised I posted in the mysql forum, please move it to the PHP one if necessary!
  11. Yeah, I just worked that out about a minute before you replied. You had actually used $upper twice but I changed the wrong one. Gets a bit confusing sometimes! Thanks again, you saved me alot of bother. Stephen
  12. Thanks for your help. However I'm running this query: SELECT * FROM tblpeople WHERE `dob` BETWEEN CURDATE( ) - INTERVAL 1 YEAR AND CURDATE( ) - INTERVAL 10 YEAR There are people in the table with DOBs ranging from 1983-05-05 to 2002-09-07 and the query isn't returning any records. Stephen Edit... Got it: I had got the upper and lower switched round - In your query above you had upper twice and I changed the wrong one. Thanks for your help!!
  13. I have an age range coming in as a POST variable in the form a-b where a is the lower boundary and b is the upper one. In my database, the DOB of various people are stored. Can anyone tell me the BETWEEN query to select the people that are within the age range $lower and $upper, according to their date of birth? I really hate working with dates! Many thanks, Stephen
  14. Personally, I wouldn't submit any of my PIN codes/passwords to that site. It looks quite unprofessional especially with some elements (i.e. the forms) which appear to be copied and pasted code. If my internet connection dies, I have lost my passwords. The system I use (Encrypted on hard disk) means I have peace of mind when I back-up my own passwords, and don't have to leave them in trust of a one-man business. Sorry, but that's just my personal opinion of the idea/site, maybe others will think otherwise. Stephen
  15. pixy: I'm not font of the background myself - is there any colour/pattern you would suggest? P.S. What is your avatar gif showing?  ??? Thanks for the comments. Stephen Edit: Background lightened - much better thanks.
  16. Thanks for that. I am familiar with styling lists, however I dont really understand the advantage of it. Currently I have a simple <div class='menu'><a>Link</a><a>Link2</a></div> etc, so im free to style as I like through css. Maybe you could explain? I got the location page validated now, its strange that google doesnt produce the links with &amp;, thanks for the help. Thats my 2nd fully accessible/tableless site I've made now, so hopefully I'll be able to get a few more jobs. Regards, Stephen
  17. AndyB: Thanks for the tip regarding the google map. I validated it on another site I made, but couldn't remember how. Regarding payment, I'm good friends with the shop owner, so that isn't a problem - he seems very happy with the site, the google map amazed him when he was able to switch to satelite mode and view a city he is visiting on Monday, not much mention of the control panel that took 60% of the time to make! However I still don't know how much my design and PHP skills are worth. I will be getting around $450-500 for that site. Is that cheap/just right/or is the shop owner offering too much? Regards, Stephen P.S. I didn't actually mention that I would like some critique for the site please!
  18. [url=http://www.classicurbanwear.net]http://www.classicurbanwear.net[/url] I've almost completed Classic Urban Wear. It's finished apart from a bit of content here and there. All pages except the location one are w3 valid, the google map seems to be throwing up the errors. I made this site for a man I know in town who owns the shop and through a password protected control panel, he can add/delete brands, Collection pictures, events and modify the information box up top. There is an RSS feed for the events. The site is all css and divs and made in around 20 hours. Can anyone give some guidance on how much $$ that site would be worth? I know this one will go cheap, but it's for future projects. Thanks for any comments, Stephen
  19. Thanks for the help. Im going to have to just put the actual code in the file and use an include to get the private bits. Regards Stephen
  20. Thanks for your help. Is there a function to include the actual code and not just the output. I can't place the actual code in the script for security reasons, hence the reason Im using includes. Regards, Stephen
  21. Hi, I have a simple script uploaded to mydomain.com/test.php containing the following: [code]<?php setcookie("tester"); echo "tester"; ?>[/code] I then have a file hosted locally with the following code: [code]<?php include "http://www.mydomain.com/test.php"; ?>[/code] When I run the local file, the echo text is shown, however the cookie isn't set. If I place test.php locally also, the include works as expected. Thanks for any help, Stephen
  22. I mentioned in another thread that notifications don't seem to be working correctly. I may only get notification for 1 out of 10 new topics in the freelancing forum. Stephen
  23. I have re-subscribed. See above :) Stephen
  24. I have noticed since the forum switch, that despite having re-subscribed to forum notifications, I might only receive 1 in 10 of them. Has anyone else noticed this problem? Also, with the old forum, I received all of the topic text, which is handy for freelancers! Regards, Stephen
×
×
  • 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.