Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. session_start(); $_SESSION['whatever'] = $_POST['whatever']; ?
  2. well your header is going to login_success.php while you said the page was called login_sussece.php. Idk if that was a typo, but obviously there is something wrong with the header
  3. PHP automatically passes objects by reference, not all variables. You use the & character for variables that are not objects, and the & does a little more than just passing by reference. (check out the manual for more information) As far as speed, yes speed is important when you are programming, but the pass by value vs. by reference decision is made when you need the functionality of one over the other. When you need too pass by reference, you do, and likewise, if you need to pass by value, you do. Also the example you cited had nothing to do with passing by reference or value, so I don't see how its relevant
  4. echo "<span class='error'>An error has occured: ". $ts_obj->error . "</span>";
  5. For the most part I use the second style. Just looks better to me
  6. where do you define $current_time_display? if you use a timestamp, you can do something like the following $time = strtotime("+ 5 hours"); if you use the date() function, just pass that line above into the second optional parameter
  7. i dont quite understand your question, but if you want the value entered in the select box, on whatever page that form submits to, you can access the value like so $value = $_POST['item']; its $_POST['item'] because "item" is the name of the form
  8. they are all they same I believe, they just change which format the data is saved in (an object, associative array, numeric array, etc.)
  9. the error is pretty clear. PHP couldn't find the file you specified. make sure the file is located where you expect it to be located, and your include path is correct
  10. depends on how much traffic your site gets. if your site starts slowing you may want to get more space/bandwidth
  11. the SERVER array has a lot of defined constants. The one you are looking for is QUERY_STRING echo $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];
  12. I thought it was ok, and the visuals/wildlife were awesome, but (as Nightslyr predicted) some of the movements/speech is a little awkward and clunky. And its basically a huge guilt trip. It was kind of boring too, 2 hours of that marine becoming an alien... no action whatsoever (excluding the time where he gets attacked by those dog... things) But the last 40 minutes were pure epic, and made up for it
  13. LOL he doesn't only go back for one more, but a whole 12 pack of budwieser (or wat looks like bud) some people in the comments think he's on GHB though, which i doubt
  14. how exactly is the data randomly sorted? where do you pull the data from? is it in a different order every time the page refreshes. some code would help too
  15. did you read the error message failed to open stream: No such file or directory in That means that whereever your require string is pointing, the file doesn't exist. verify that the file you are trying to include is located where you expect it to be included
  16. mysql has an avg command for getting averages. an example $query = "SELECT AVG(hits) as avgHits FROM table"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $avg = $row['avgHits']; Edit: sorry didn't answer the whole question using this AVG command, you could use the timestamps and the greater then operator to get hits from the last 24 hours. something like $secsInDay = 60*60*24;//60 secs a min * 60 mins an hour * 24 hours a day $timestamp = time() - $secsInDay;//gets current timestamp and subtracts amount of secs in day, thus 24 hours before $query = "SELECT AVG(hits) as avgHits FROM table WHERE timestamp > ".$timestamp; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $avg = $row['avgHits']; Be aware this is untested, but the basic idea is there
  17. a couple of things to help debug. verify that your server is actually sending the email by doing something like if (!mail($to, $subject, $message, $headers)){ echo "Mail did not send"; } If it is indeed sent, verify that its not in your spam folder. If not, then we can go from there
  18. you want to look into the php date() function. specifically the "time" formats
  19. I personally dislike java applets because I think they are slow and hog resources. Also, although most computers have the JVM installed, some don't, while all modern browsers (IE, Chrome, FF, Opera, etc.) have Javascript. The downside to AJAX though is that Javascript can be turned off. I personally would go with AJAX, but if you are more comfortable with java go with that
  20. A lot of how fast you can read something depends on the connection to the server/server's connection to the other server. Saving locally would make loading it fastest, but loading a large file from another server is gonna take a bit of time regardless. You may be able to speed it up a little with AJAX, but beyond that, I'm not sure of any way to speed it up much.
  21. Well, you are passing in the string NULL, since you surround NULL with single quotes, rather than the value NULL. But if you want the current time stamp, either not including the column time in the update query, stripping the quotes around NULL, or changing 'NULL' to NOW() should work
  22. and a Merry New Year?
  23. I don't see how that query would work. You don't even have an operator next to the WHERE clause. but MySQL has a between operator its usage is simple. something like SELECT * FROM table WHERE column BETWEEN low and high obviously low and high would be your min and max numbers[/code]
  24. What exactly do you mean by "falls apart"? It could be a number of things. Are you getting a PHP error? blank page? have you tried echoing the num_rows variable to see that it has what you expect? Taking these steps will help solve the problem faster. But your problem is probably with the column "index". index is a reserved word so you can't use it as column/table names. You either have to change the column name (which is usually suggested, because using reserved words as column/table names can make your queries confusing) or surround the word "index" in your query with backticks like so $query = "SELECT * FROM idiot WHERE `index` = '15'";
  25. Looks fine to me. One thing tho, when you create an MD5 hash of a password, you don't need to use real escape strings on it, because you could get some unwanted results. if someone puts a ' in the password, then its md5 hash will be different \'. Besides that, and stylistic differences I might have had, it looks good
×
×
  • 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.