Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Where is the error reported?
  2. Looks much better, thankyou Ok, time to work backwards from the error and find out what's wrong. First, print out your SELECT query to see that it's correct. If it's not correct, print out $article_id to see if that is correct. If $article_id is not correct, then print out $_GET['id'] (where $article_id came from).
  3. Try the following: $a = 1; foo(&$a); print "a = $a\n"; bar($a); print "a = $a\n"; function foo(&$a) { $a = $a + 1; } function foo($a) { $a = $a + 1; } When $a is passed by reference and modified inside the function, the original copy is modified too. They are the same variable. But if it is passed by value (the default behaviour) then only the copy inside the function is modified. You should probably ask the script's vendor for advice on what to do.
  4. Ok, I just saw your edit. The problem is your INDENTING If you indent your code properly, then you will find what you are missing, and the error will go away. You are missing a closing brace somewhere (the '}' symbol). It's hard to tell where it is missing, because your indenting is not consistent.
  5. I did some face recognition research while at uni. What's in the public domain is complex, crude and not very effective. The reason is that an effective face recognition system has enourmous value, and will be snapped up by the government or military immediately.
  6. Can you check the code nearby? What you posted is correct, so the syntax error is somewhere else.
  7. Thanks, that's much better Ok, next is to check for errors on all your mysql queries, especially on the ones you suspect. Make them look like this: mysql_query("...") or die(mysql_error()); Even better is if you store the query in a variable, so you can print out the query along with your error, like this: $sql = "SELECT * FROM foo"; mysql_query($sql) or die("Error in $sql\n" . mysql_error());
  8. If bigint is too small, you can use decimal/numeric. All these types have maximum ranges, so you may still need to resort to varchar in extreme cases. The manual clarifies everything (make sure to check for your version of mysql)
  9. Try this one out. I am not 100% convinced that it works, but it works for the test cases i've tried. function birthday($birthday){ list($month,$day,$year) = explode("-",$birthday); $month_diff = date("m") - $month; $day_diff = date("d") - $day; $year_diff = date("Y") - $year; if ($day_diff < 0) { $month_diff--; } if ($month_diff < 0){ $year_diff--; } return $year_diff; }
  10. Ok. Given that description, the simplest way I can think of is to set a variable inside the default case, like this: ... default: $default_case = true; IndexPage(); } Then later you can do this: if ($default_case) { # Do the default case stuff } Edit: If you are inside a function, you must do "global $default_case;" before accessing the variable
  11. Is this an inactivity timeout? If so, you will need to notify the user from javascript when the timer is going to run out.
  12. The logic here is faulty: if ($day_diff < 0 || $month_diff < 0){ $year_diff--; } Look at the following cases: 2000-01-01 2000-01-31 2000-02-01 2000-02-31 2000-08-01 2000-08-31 2000-09-01 2000-09-31 That should be enough to get the logic right
  13. You need to call session_start() at the beginning of your script in order for sessions to work (unless you have sessions set to start automatically)
  14. Scarhand, can you create a small piece of code that replicates your problem. Then we can debug that. The other option is to post your FULL code, along with instructions on how to replicate the problem. So far, you have only given us portions of your code, and all those portions work correctly. Showing us code that works does not help us fix your problem
  15. Can you please fix your indentation? Otherwise I can't understand your code. You should never have things looking like this: } } and NEVER EVER have things looking like this: } } Instead, it should look like this: if (something) { do some blah; while (somethingelse) { some more blah; } }
  16. There is no need for break in the default case. Can you try adding a simple statement like "print 'hello, i am the default case'; exit(0);" in the default case? Just to check that it's actually being reached. I have a suspicion that IndexPage() is not working as you expect.
  17. Is register_globals on? You can check by creating a script that calls phpinfo() The impact is that with register_globals on, $username is registered as a global variable. That means that if you set $username later in your script, you will be modifying the session value.
  18. Have you considered using sessions?
  19. $query="INSERT INTO viewz(name,title,mail,choice,comments,) VALUES('$_POST[name]','$_POST[title]','$_POST[mail]','$_POST[choice]', '$_POST[comments]')"; Instead, try this: $query="INSERT INTO viewz(name,title,mail,choice,comments) VALUES('{$_POST['name']}','{$_POST['title']}','{$_POST['mail']}','{$_POST['choice']}', '{$_POST['comments']}')"; Changes: Remove comma after comments. Add {} around variables Add '' around array indexes for $_POST This doesn't handle escaping of the input data, so it's not secure. It is vulnerable to mysql injection.
  20. I've seen one site which stored the link in an encoded form, waited in javascript, and then used javascript to decode the link and place it in the page. Not a perfect solution, since it can be decoded manually by the user.
  21. Auto increment is a database concept, rather than a text file concept. You may be able to use the "modified time" fetched by stat() as a substitute. Or you can manually add a value in the text file and update it yourself each time.
  22. Here are some of the common tools I use top - displays processes using the most processor power. Also gives a summary at the top of "system time" (usually disk reads/writes) ps - displays detailed information about processes iostat - displays details about i/o tail -f /var/log/apache/access.log - Shows requests as they come in (if your logs are in the default location). May not be useful if you have 30 concurrent users unless you filter the data with "grep". grep - Possibly the most useful tool for unix. It displays lines matching a particular expression, perfect for extracting information from log files Those are all quite crude methods, and won't give you much detail. But they will tell you if your box is about to blow up due to lack of some critical resource. They are a good first stop for diagnosing problems. The other important number is the load (displayed by top and w). Load indicates the number of processes waiting for something. If it's high, then you probably have a problem. Through observation you can tell when system performance is impacted by a high load figure (this depends very much on your system), and then setup an alert for that load figure. Oh, a good monitoring package is nagios. It can be configured to alert you when things are exceeding limits or not functioning. Good things to monitor are load, cpu usage, disk space, and response time for http requests.
  23. The new php probably has register_globals switched off. Add this at the top of your script: $catagory = $_REQUEST['catagory']; You will need to do the same for all data which comes in via post, get, cookie and session.
  24. No, but ... ORDER BY zipCode at the end of your query should give you the ordering you want. But this is nothing to do with the order you listed the parameters in the query. It's to do with the values in the zipCode column.
×
×
  • 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.