Spring
-
Posts
224 -
Joined
-
Last visited
Posts posted by Spring
-
-
The user can simply delete the session cookie.
Yeah i know. I'll inevitable have to use the database to store the timestamp, but this is a temporary fix until tomorrow.
-
I don't see how that's possible. As was mentioned above, sessions expire when the user closes their browser.
session_set_cookie_params()
worked for me.
-
I fixed mine by using sessions.
session_start(); session_set_cookie_params(84600); if(isset($_POST['submit'])){ $_SESSION['clicked'] = 1; }
You should know what to do from here. (:
-
I fixed by using sessions like suggested, thanks for everyones support.
-
Still looking for a simpler soultion, this should be possible without having to use the database, how would I check it with sessions? anyone know?
-
Depends on what you mean by "once a day". If I click today (Monday) at 11:59PM, can I click again tomorrow (Tuesday) at 12:01AM even though it's been only 2 minutes?
Just 24 hours time. All I want is a 24 hours between clicks on the submit button for each person.
-
I'm not sure how that would, that's why I wanted an example, how do I use the php time function to check if they clicked within 24 hours?
-
Perhaps updating the database right away, and then caching the results for the user for a certain period of time would be a solution.
Otherwise you'd probably have to store everything in a temporary directory, and then set up a cron job to scan the folder and make the DB updates.
I have the same question, but I was pretty sure you could some how use a php time function to do this..or maybe javascript? Is going through all that trouble the only way?
-
Is there a way to use PHP time to only allow a user to press a button in a form (for example a submit button) once a day? If so, could I get an example? Thanks.
-
mysql_query($insertAdminInfoQuery) or die("ERROR: " .mysql_error())
Forgot a semicolon, though I didn't even really read the whole script, just followed the error.
needs to be
mysql_query($insertAdminInfoQuery) or die("ERROR: " .mysql_error());
-
UPDATE account_info SET experience = experience + 7 WHERE username = $name
This worked perfectly, thanks a lot.
-
Hi, I have a field called experience in mysql and I want to add +7 to said field, is it possible using UPDATE or insert? If so, what's the syntax?
Here's what I have that doesn't work, it sets experience to 7, but won't add another 7 when clicked again.
if(isset($_POST['submit'])){ $query = "UPDATE account_info SET experience = +7 WHERE username = $name"; $result = mysql_query($query) or die(mysql_error()); }
don't ask for the whole script, because you won't need it to answer that o.0
-
Everything is working great now! I figured out what happen!
Thanks!
-
Edit:
got this:
sql: SELECT * FROM account_info WHERE username = "tony"
result: Resource id #3
after mysql_fetch_array
0
-
<?php include "database.php"; session_start(); $name = $_session['outname']; function output_wins($name){ $sql = "SELECT * FROM account_info WHERE username = '$name'"; $result = mysql_query($sql) or die(mysql_error()); $wins = mysql_fetch_array($result); return $wins['win']; } ?>
-
change the mysql_query line to this:
$result = mysql_query($sql) or die(mysql_error());
I did and this is the error:
mysql_fetch_array(): supplied argument is not a valid MySQL result resource
-
Ah, here's the error:
mysql_fetch_array(): supplied argument is not a valid MySQL result resource
-
Ehh, it seems to work but it's not outputting anything. It's blank.
-
$sql = 'SELECT * FROM account_info WHERE username ="'.$name.'"'; $result = mysql_query($sql) . mysql_error(); $row = mysql_fetch_row($result);
I get
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
I'm trying to output the row "wins" for a certain user.
-
How do I got about outputing one row that can only hold one value? Any reason why the function below doesn't work?
<?php include "database.php"; session_start(); $name = $_session['outname']; function output_wins(){ $sql = 'SELECT * FROM account_info WHERE username ="' . $name .'"'; $result = mysql_query($sql); $wins = mysql_fetch_array($result); echo $wins['win']; } output_wins(); ?>
Is there an easier way I can output this one row?
-
Respect my authority.
Jokes. Please don't hurt me.
I'd like to give thanks to all of the people who have helped me recently on the problems I have been having with PHP. Sometimes, when I get a question answered, I'll be so excited to try out the solution myself, I forget to give thanks to that person who spent time out of his/her day to help me.
I think the website is great and hope that it will be here for the long run. I would have probably given up no php without this site, hell, I predict that soon half of this websites posts will belong to me asking for help.
-
I fixed by doing this.
body{ width: 800px; height: 600px; }
-
Ehhh, css doesn't offer a fix to this? I don't want to redo the css for each screen size.
-
He has different monitor dimensions than me, is there something ins css that will work for all dimensions?
VERY SIMPLE QUESTION
in PHP Coding Help
Posted
You should start using <br /> instead of <BR> <BR> is old HTML which is dieing.