-
Posts
2,965 -
Joined
-
Last visited
Everything posted by mikesta707
-
session_start(); $_SESSION['whatever'] = $_POST['whatever']; ?
-
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
-
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
-
echo "<span class='error'>An error has occured: ". $ts_obj->error . "</span>";
-
For the most part I use the second style. Just looks better to me
-
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
-
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
-
they are all they same I believe, they just change which format the data is saved in (an object, associative array, numeric array, etc.)
-
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
-
depends on how much traffic your site gets. if your site starts slowing you may want to get more space/bandwidth
-
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'];
-
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
-
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
-
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
-
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
-
getting the total average hits for today (using unix timestamp)
mikesta707 replied to yjim's topic in PHP Coding Help
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 -
Please help with Contact Form using PHP and Flash!
mikesta707 replied to ven0mblade's topic in PHP Coding Help
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 -
you want to look into the php date() function. specifically the "time" formats
-
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
-
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.
-
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
-
and a Merry New Year?
-
problems with search form numerical "between" sending by php
mikesta707 replied to 4x4ing's topic in PHP Coding Help
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] -
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'";
-
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