Jump to content

Seaholme

Members
  • Posts

    81
  • Joined

  • Last visited

Everything posted by Seaholme

  1. Hi, I'm struggling to solve what seems to be potentially quite a simple problem with my form! It's for a really basic web-based racing game, and basically the issue is that in the form, the option I've named "teamid" isn't sending any information forwards so $newteamid in the next section is always =0, which is the default in the MySQL database. I just don't know how to set it! I want the team id from the first part to send through into the second part. Is it possible to have the value of a form option set to being a variable like this?? //Find their teams and let them pick which team to use $findteams = mysql_query("SELECT * FROM team WHERE owner='$id'") or die(mysql_error()); echo "Select which team to race with:<br><form action='regional.php' method=post> <select name=teamid value=teamid> Team:"; while($row = mysql_fetch_array( $findteams )) { $teamid = $row['id']; echo "<option name=teamid value={$row['id']}>{$row['teamname']}</option>"; } echo '</select>'; echo "<bR><br>Is your team ready to go?<br><br><input type=submit name='stage1' value='Begin Race!'></form><br><br>"; if(isset($_POST['stage1'])) { $_POST['teamid'] = $newteamid; echo $newteamid; $startrace = @mysql_query("INSERT INTO regionals (teamid, stage, ownerid) VALUE ('$newteamid', '1', '$id')") or die("Error: ".mysql_error()); Please let me know if I need to explain or elaborate at all, I'd appreciate any help. Thanks guys!
  2. I apologise in advance if this is a simple question, but essentially I have a forum with the following code: if($a_answer == '') die("You must enter in a reply!"); And my problem is that when nobody enters a reply and it does default to the die option, that nothing subsequent to the die command shows up on the page below it, including the footer of the website, which leaves the whole thing looking very unprofessional. Is there a way to add the website footer into the 'die' command? (I've tried and failed). Or should I be using a different command from die that's more suited to what I'm trying to achieve? The footer is attached to the page via an include command. Any suggestions gratefully received!
  3. Yep, it does. It's a number to say which item it is. I've been thinking about it and I was wondering, is it possible that because one of those lines deletes the item from the database that that is giving the error?
  4. Ah elsewhere in the script, it comes from the URL as a $_GET['id'] type thing. I've checked all of the variables by echoing them out and they do -- also the script itself functions perfectly, which it wouldn't do if any of the variables were wrong. That's kinda why I'm very confused!
  5. Hey all, I keep getting this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2 When I use the script below. I'm finding it a bit confusing because everything about it continues to work, it's just it gives me an error. When the script runs, the outcome is "Success! Your dog now looks far more energetic! Looks like this food is all used up." Followed by the error, which cuts the remainder of the page off. Does anybody know why it's doing this? $dogyay = $_POST['dogid']; $checkenergy = "SELECT energy FROM dogs WHERE id=$dogyay"; $energylevel = mysql_query($checkenergy) or die(mysql_error()); $row = mysql_fetch_array($energylevel) or die(mysql_error()); if($row['energy'] >= 100) { echo "<b>Oops!</b> Looks like your dog is full right now...";} else{ echo "<b>Success! Your dog now looks far more energetic!</b><br><br>"; $sql11="UPDATE dogs SET energy=energy + 50 WHERE id=$dogyay"; $result11=mysql_query($sql11); $sql12="UPDATE items SET uses = uses - 1 WHERE itemid=$id"; $result12=mysql_query($sql12); $checkuses = "SELECT uses FROM items WHERE itemid=$id"; $useslevel = mysql_query($checkuses) or die(mysql_error()); $row = mysql_fetch_array($useslevel) or die(mysql_error()); if($row['uses'] == 0) { echo "Looks like this food is all used up.<bR><br>"; mysql_query("DELETE FROM items WHERE itemid='$id'") or die(mysql_error());} Thanks !
  6. Sure, I'll try to indent it a bit if that helps. Out of interest, what would you use instead of while loops to get rows from a table? I only know the one way which is why I use it :X I don't know if this is what you meant, but it now has some indentations in it, hopefully in the right places! if(isset($_POST['submit'])){ $ownerid = $_SESSION['id']; // If completed = Y give forth the NO WAY sign $completeyn = "SELECT completed FROM activities WHERE playerno='$ownerid' AND activityno = '1'"; $completecheck=mysql_query($completeyn) or die(mysql_error()); while($row = mysql_fetch_array( $completecheck )) { if($row['completed'] == 'Y'){ echo 'Oops, you\'ve already done this twice today!';} else { // Enter them into the activities database if they're not already there $stepno2 = "SELECT playerno, timesdone FROM activities WHERE playerno='$ownerid' AND activityno = '1'"; $stepnoanswer2=mysql_query($stepno2) or die(mysql_error()); $num_rows2 = mysql_num_rows($stepnoanswer2); echo $num_rows2; if($num_rows2 == '0'){ $putintodb2 = mysql_query("INSERT INTO activities (playerno, activityno, timesdone) VALUES ('$ownerid', '1', '1')") or die("Error: ".mysql_error()); echo 'Randomevent1'; }else{ // If they are already there update their stepcount $updatestepcount2=("UPDATE activities SET timesdone=timesdone+'1' WHERE playerno='$ownerid' AND activityno = '1'"); $newstepcount2=mysql_query($updatestepcount2); echo 'Randomevent2';} // If this new stepcount is equal to 2, set completed to Y $checkstep = "SELECT timesdone FROM activities WHERE playerno='$ownerid' AND activityno = '1'"; $checkstepresult=mysql_query($checkstep) or die(mysql_error()); while($row = mysql_fetch_array( $checkstepresult )) { if($row['timesdone'] == '2'){ echo $row['timesdone']; $updatestepcount22=("UPDATE activities SET completed = 'Y' WHERE playerno='$ownerid' AND activityno = '1'"); $newstepcount22=mysql_query($updatestepcount22); } }}}} Thanks! EDIT: also thanks for that thing about the numbers, I've changed them all (although not above). Is it just bad practice or does it actually slow the script down to have ' marks around numbers?
  7. Hey all, Basically I have this code which technically should work, but I have put an error in the logic somewhere and am really struggling to find it, I've been going over it for about an hour now :/ The error is that in the second part (// Enter them into the activities database if they're not already there), it won't enter them, and it won't show the word 'Randomevent1' either, so clearly somehow I have put in something to prevent it performing that step. Can anybody help me out? I'd be amazingly grateful, I have no clue how I've screwed it up. if(isset($_POST['submit'])){ $ownerid = $_SESSION['id']; // If completed = Y give an error $completeyn = "SELECT completed FROM activities WHERE playerno='$ownerid' AND activityno = '1'"; $completecheck=mysql_query($completeyn) or die(mysql_error()); while($row = mysql_fetch_array( $completecheck )) { if($row['completed'] == 'Y'){ echo 'Oops, you\'ve already done this twice today!';} else { // Enter them into the activities database if they're not already there $stepno2 = "SELECT playerno, timesdone FROM activities WHERE playerno='$ownerid' AND activityno = '1'"; $stepnoanswer2=mysql_query($stepno2) or die(mysql_error()); $num_rows2 = mysql_num_rows($stepnoanswer2); echo $num_rows2; if($num_rows2 == '0'){ $putintodb2 = mysql_query("INSERT INTO activities (playerno, activityno, timesdone) VALUES ('$ownerid', '1', '1')") or die("Error: ".mysql_error()); echo 'Randomevent1'; }else{ // If they are already there update their stepcount $updatestepcount2=("UPDATE activities SET timesdone=timesdone+'1' WHERE playerno='$ownerid' AND activityno = '1'"); $newstepcount2=mysql_query($updatestepcount2); echo 'Randomevent2';} // If this new stepcount is equal to 2, set completed to Y $checkstep = "SELECT timesdone FROM activities WHERE playerno='$ownerid' AND activityno = '1'"; $checkstepresult=mysql_query($checkstep) or die(mysql_error()); while($row = mysql_fetch_array( $checkstepresult )) { if($row['timesdone'] == '2'){ echo $row['timesdone']; $updatestepcount22=("UPDATE activities SET completed = 'Y' WHERE playerno='$ownerid' AND activityno = '1'"); $newstepcount22=mysql_query($updatestepcount22); } }}}}
  8. Oooh, gotcha! Clearly wasn't looking carefully enough there! Awesome, thank you both so much for the very clear explanations, sorry for being a bit slow!
  9. I'm afraid I'm not really knowledgeable enough to know what you mean by that. Do you mean that I should change it from for instance: $input4 = array("HD, HD, HD, HD, HD, hd"); $rand_keys4 = array_rand($input4, 2); $HD1 = $input4[$rand_keys4[0]] . "\n"; $HD2 = $input4[$rand_keys4[1]] . "\n"; to $input4 = array("HD, HD, HD, HD, HD, hd"); $rand_keys4 = array_rand($input4); $HD1 = $input4[$rand_keys4[0]] . "\n"; $HD2 = $input4[$rand_keys4[1]] . "\n"; ?? I don't quite follow the significance of the "...."! Thanks so much.
  10. Hey, This is my [faulty] PHP $input3 = array("BB, BB, BB, BB, BB, BB, BB, BB, BB, bb"); $rand_keys3 = array_rand($input3, 2); $BB1 = $input3[$rand_keys3[0]] . "\n"; $BB2 = $input3[$rand_keys3[1]] . "\n"; $input4 = array("HD, HD, HD, HD, HD, hd"); $rand_keys4 = array_rand($input4, 2); $HD1 = $input4[$rand_keys4[0]] . "\n"; $HD2 = $input4[$rand_keys4[1]] . "\n"; $input5 = array("DD, DD, DD, DD, DD, DD, DD, dd"); $rand_keys5 = array_rand($input5, 2); $D1 = $input5[$rand_keys5[0]] . "\n"; $D2 = $input5[$rand_keys5[1]] . "\n"; $input6 = array("CC, CC, CC, CC, CC, cc"); $rand_keys6 = array_rand($input6, 2); $C1 = $input6[$rand_keys6[0]] . "\n"; $C2 = $input6[$rand_keys6[1]] . "\n"; $input7 = array("HG, HG, HG, HG, HG, HG, HG, HG, HG, HG, HG, HG, HG, HG, HG, HG, HG, HG, HG, hg"); $rand_keys7 = array_rand($input7, 2); $HG1 = $input7[$rand_keys7[0]] . "\n"; $HG2 = $input7[$rand_keys7[1]] . "\n"; And this is the error I'm getting: Warning: array_rand() [function.array-rand]: Second argument has to be between 1 and the number of elements in the array in /home/content/91/6351791/html/dogtrader.php on line 48 Warning: array_rand() [function.array-rand]: Second argument has to be between 1 and the number of elements in the array in /home/content/91/6351791/html/dogtrader.php on line 54 Warning: array_rand() [function.array-rand]: Second argument has to be between 1 and the number of elements in the array in /home/content/91/6351791/html/dogtrader.php on line 60 Warning: array_rand() [function.array-rand]: Second argument has to be between 1 and the number of elements in the array in /home/content/91/6351791/html/dogtrader.php on line 66 Warning: array_rand() [function.array-rand]: Second argument has to be between 1 and the number of elements in the array in /home/content/91/6351791/html/dogtrader.php on line 72 I've checked back over it all and looked up the function in various places to check what they say about it, but can't see which bit I'm going wrong wit! :[ If anybody has any advice as to what to do to fix it, it would be much appreciated. Cheers.
  11. Hey, I have a Chat system which consists of a main page with 3 iframes situated within it: iFrame 1 = the list of people in the Chat iFrame 2 = the chat log, displaying the messages entered into the Chat iFrame 3 = the form into which you enter your message and then click Submit so that your message is entered into the Chat log Basically what I want is that, when you submit a message via iFrame 3, it refreshes iFrame 2, so you enter in a message and can then see the refreshed version of the chat log and therefore see your new message. The problem is that I'm not sure how to get it so that submitting the form refreshes the iframe. Nor am I 100% sure whether you can refresh one iFrame from within another iFrame. One solution to the second problem is to put the submission form (currently in iFrame 3) onto my main chat page which at the moment just contains the 3 iframes, but even then I don't know how to make submitting the form refresh the chat log! Any help/advice would be appreciated Thanks!
  12. Thanks! That has solved the ' --> \' bit. However I still have the problem that " cuts off the rest of my message :[
  13. Hey, I've created a messaging system for my site and I'm trying to make it so that a copy of the original message is included and automatically put into the message content box when somebody clicks to reply. I've done this literally just by making the "reply" button into a form which also posts the content of the message from the previous page and puts it into the content box. However I have some issues with it: firstly, wherever ' is used, it becomes \' and wherever " is used, the whole of the rest of the message is blanked out. Can anybody point me in the direction of the solutions I might need to make it so that ' and " both appear normally without cutting the rest of the message off? Thanks in advance & let me know if anything is missing!
  14. Hey, I'm not really sure how to hold pagination in a session I'm afraid. Can you elaborate as to how $pagenum is wrong? Thanks very much!
  15. Hey guys, Basically I've got a code which is meant to give me a second page after 10 entries and show 10 entries a page, however I've been struggling with it for some time and it just won't work. Right now it'll change the URL and move onto the next page (supposedly) but no matter what page I'm on all it does is show every single entry. Can anybody help me work out what's going wrong? <?php include('connect.php'); include('header.php'); include('loggedin.php'); // fetch line id from URL $id=$_GET['id']; // set maximum and minimum IDs if($id > '6'){ echo "Oops, no such line exists!"; } elseif($id < '1'){ echo "Oops, no such line exists!"; } else { // find all posts on this board $sql="SELECT * FROM $tbl_name WHERE forumid=$id ORDER BY lastreply LIMIT $pagenum, $max DESC"; // ORDER BY id descending $result=mysql_query($sql); ?> <table width="70%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td width="50%" align="center" bgcolor="#E6E6E6"><strong>Topic</strong></td> <td width="12%" align="center" bgcolor="#E6E6E6"><strong>Views</strong></td> <td width="12%" align="center" bgcolor="#E6E6E6"><strong>Author</strong></td> <td width="13%" align="center" bgcolor="#E6E6E6"><strong>Replies</strong></td> <td width="13%" align="center" bgcolor="#E6E6E6"><strong>Last Reply</strong></td> </tr> <?php $pagenum = $_GET['pagenum']; if (!(isset($pagenum))) { $pagenum = 1; } //Here we count the number of results //Edit $data to be your query $data = mysql_query("SELECT * FROM $tbl_name WHERE forumid=$id ORDER BY lastreply DESC") or die(mysql_error()); $rows = mysql_num_rows($data); //This is the number of results displayed per page $page_rows = 10; //This tells us the page number of our last page $last = ceil($rows/$page_rows); //this makes sure the page number isn't below one, or more than our maximum pages if ($pagenum < 1) { $pagenum = 1; } elseif ($pagenum > $last) { $pagenum = $last; } //This sets the range to display in our query $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; $data_p = mysql_query("SELECT * FROM $tbl_name WHERE forumid='$id' ORDER BY lastreply DESC") or die(mysql_error()); //This is where you display your query results while($info = mysql_fetch_array( $data_p )) { ?> <tr> <td bgcolor="#FFFFFF"><a href="view_topic.php?id=<? echo $info['id']; ?>"><? echo $info['topic']; ?></a><BR></td> <td align="center" bgcolor="#FFFFFF"><? echo $info['view']; ?></td> <td align="center" bgcolor="#FFFFFF"><a href=profile.php?id=<? echo $info['name']; ?>><? echo $info['displayname']; ?> (#<? echo $info['name']; ?>)</a></td> <td align="center" bgcolor="#FFFFFF"><? echo $info['reply']; ?></td> <td align="center" bgcolor="#FFFFFF"><? echo $info['lastreply']; ?> by (#<? echo $info['lastreplyauthor']; ?>)</td> </tr> <?php } // First we check if we are on page one. If we are then we don't need a link to the previous page or the first page so we do nothing. If we aren't then we generate links to the first page, and to the previous page. if ($pagenum == 1) { } else { echo " <a href='{$_SERVER['PHP_SELF']}?id=$id&pagenum=1'> First Page</a> "; echo " "; echo " // Page $pagenum of $last //"; $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?id=$id&pagenum=$previous'> Previous Page</a> "; } //just a spacer echo " "; //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last) { } else { $next = $pagenum+'1'; echo " <a href='{$_SERVER['PHP_SELF']}?id=$id&pagenum=$next'> Next Page </a> "; echo " "; echo " // Page $pagenum of $last //"; echo " <a href='{$_SERVER['PHP_SELF']}?id=$id&pagenum=$last'> Last Page </a> "; echo " "; } // Start looping table row while($rows=mysql_fetch_array($data)){ ?> <?php // Exit looping and close connection } mysql_close(); ?> <tr> <td colspan="5" align="right" bgcolor="#E6E6E6"><a href="create_topic.php?id=<? echo $id; ?>"> <strong>Create New Topic</strong></a></td> </tr> </table> <?php //close max/min if statement } // This shows the user what page they are on, and the total number of pages // First we check if we are on page one. If we are then we don't need a link to the previous page or the first page so we do nothing. If we aren't then we generate links to the first page, and to the previous page. if ($pagenum == 1) { } else { echo " <a href='{$_SERVER['PHP_SELF']}?id=$id&pagenum=1'> First Page</a> "; echo " "; echo " // Page $pagenum of $last //"; $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?id=$id&pagenum=$previous'> Previous Page</a> "; } //just a spacer echo " "; //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last) { } else { $next = $pagenum+'1'; echo " <a href='{$_SERVER['PHP_SELF']}?id=$id&pagenum=$next'> Next Page </a> "; echo " "; echo " // Page $pagenum of $last //"; echo " <a href='{$_SERVER['PHP_SELF']}?id=$id&pagenum=$last'> Last Page </a> "; echo " "; } include('footer.php'); ?> Please let me know if you need more info. Thanks!
  16. I'm no expert, but I guess whatever provides your MySQL is running in a different timezone to your site. You can fix the date() one to match the MySQL one with something like this: $timezone = new DateTimeZone( "Europe/London" ); $date = new DateTime(); $date->setTimezone( $timezone ); echo $date->format( 'H:i:s l, d. F Y' ); Basically it sets the timezone. So just name the timezone your MySQL server is on. I don't know if that's the right explanation or the best solution for your problem seeing as it's only really a cosmetic change, but it's what I would do! :]
  17. Hey all, Basically I've made a working join query, but for whatever reason that query never fetches the very last piece of information from the database. I've run into this problem a couple of times now and previously I've just skipped it by adding in a non-essential field to my join query as a sort-of redundant last field, but it would be really nice to know what's causing it and just fix it instead. // Construct our join query $query = "SELECT trainingentrants.entrantscore, trainingentrants.entrantid, trainingentrants.eventid, training.gold, training.silver, training.bronze AS entrantstuff". " FROM trainingentrants, training". " WHERE trainingentrants.eventid = training.id". " ORDER BY trainingentrants.entrantscore"; ^^ That's an example of one of the queries. The very last thing in the select query - training.bronze - doesn't show. I'm pretty sure it must be an error in the syntax, but can't figure what should go there to get it included. Thanks in advance!
  18. Whyyy do the simple things hide from me?! You wouldn't believe how long I've spent trying to figure it out when the answer should've smacked me in the face. Ach! Thanks so so much!
  19. Hey there, Basically I'm having some difficulty getting this form to work: <form action=getitem.php method=post name=form2><input type=hidden name=itemid value='1'> <input type=image src=items/ricketyoldsledge.png name=free class=img></form> It'll work if it's at the top of the code for the page I want it on, however I want it to be in a later position (I've included the PHP for the whole page below, so hopefully you can see what I mean). The error I get is that the form appears to send, only instead of sending me to getitem.php it just goes back to sledmakers.php. <?php include('connect.php'); include('header.php'); include('loggedin.php'); echo 'blah blah"'; // Check profession $result = mysql_query("SELECT * FROM players WHERE id=".$_SESSION['id']) or die(mysql_error()); while($row = mysql_fetch_array( $result )) { $profession = $row['profession']; $level = $row['level'];} // if they're unemployed still if($profession == 'Unemployed'){ echo '<br><br><form action=sledmakers.php?talk=yes method=post name=form1> <input type=submit name=submit value="Talk to the man?"><bR><Br>'; } // if they're a Sledmaker elseif($profession == 'Sledmaker'){ echo 'Sledmaker';} // if they're not a Sledmaker else{ echo 'What? You\'re not a Sledmaker! Go away.';} $talk = $_GET['talk']; // if they're unemployed and pressed to speak with her if($talk == 'yes') { echo 'blahblah'; echo 'You look in the corner and find what you\'re looking for...<bR><br>'; ?> <form action=getitem.php method=post name=form2><input type=hidden name=itemid value='1'><input type=image src=items/ricketyoldsledge.png name=free class=img></form> <br><br><form action=sledmakers.php method=post name=form3> <input type=submit name=submit2 value="Become the Master Sledmakers's Apprentice?"><bR><Br> <?php } else{ echo '';} if(isset($_POST['submit2'])){ echo 'You are now an Apprentice Sledmaker!'; } include('footer.php'); ?> Can anybody help me out? :/ If you need more info, please just ask!
  20. Hey all, I'm trying to get my site's Chat to show only the last 20 posts, but I'm not doing such a great job of it. It'll show only 20 posts, but it always shows from zero to 20, when I want it to show the most recent 20. Can anybody help me out? :/ <?php include "chatconnect.php"; $getnummessages="SELECT COUNT(*) as messagecount from chatmessages"; $getnummessages2=mysql_query($getnummessages) or die("blah"); $getnummessages3= mysql_result($getnummessages2, 0); if($getnummessages3 > '21') { $startrow= $getnummessages3 - '20'; } else { $startrow=0; } $getmsg="SELECT id, name, message, IP FROM chatmessages ORDER BY postime DESC limit $startrow,$getnummessages3"; $getmsg2=mysql_query($getmsg) or die(mysql_error()); while($row=mysql_fetch_array($getmsg2)) { $message=Smiley($message); //Smiley faces echo $row['name']; echo " (#"; echo $row['IP']; echo ") "; echo $row['message']; $result3 = mysql_query("SELECT moderator FROM players WHERE id=".$_SESSION['id']) or die(mysql_error()); while($row2 = mysql_fetch_array( $result3 )) { $mod2=$row2['moderator'];} if($mod2 == '1'){ ?> <form name="input" action="deletechatreply.php" method="post"> <input type="hidden" name="id" value="<? echo $rows['id']; ?>"> <input type="submit" value="Delete" /> </form> <?php } else{} echo '<br><hr><br>'; } function Smiley($texttoreplace) { $smilies=array( '' => "<img src='images/smile.gif'>", ':blush' =>"<img src='images/blush.gif'>", ':angry' =>"<img src='images/angry.gif'>", ''=> "<img src='images/shocked.gif'>", 'fuck' => "$#$%", 'Fuck' => "&$#@" ); $texttoreplace=str_replace(array_keys($smilies), array_values($smilies), $texttoreplace); return $texttoreplace; } ?> <script> setTimeout("window.location.replace('chatlog.php')",20000); </script> Thanks if you can!
  21. Wow, well that probably should've been obvious ^__^; Thanks!
  22. Hey, I've been searching and so far had no luck, so I wondered if somebody here might be able to assist me. I have a UNIX timestamp via the strtotime function, but I want to convert it back from that and into a date which I can display to people. Does anybody have any idea to do this? Thanks!
  23. Hey, I'm trying to work out how long it is between the present time and a previous time which I am retrieving from my database. Both of the dates are in the same format, but no matter what I do the difference comes out as the number 8! Can anybody help me fix this up? All of the variables (the lastclick and the currentdate ones) are working when I echo them, sooo.... // Find highest answer number. $sql = "SELECT * FROM players"; $result2=mysql_query($sql) or die(mysql_error()); while ($rows=mysql_fetch_array($result2)){ echo $rows['lastclick']; } $currentdate=date("G:i:s d/m/y"); $difference = $currentdate - $rows['lastclick']; echo $difference; Thanks!
  24. You might want to try setting it so that the form action is to submit the same page, which you can do with PHP_SELF: <form method="post" action="<?php echo $PHP_SELF;?>"> Then you want to make it so that the page has a set of instructions as to what it should do IF it sees that the submit button has been pressed, which means you need an if clause a little like this... if(isset($_POST['submit'])) { whatever } else { whatever else} ... with {whatever} being whatever you want to happen if the submit button HAS been pressed, and {whatever else} being whatever you want to appear if it hasn't. I hope that helps you and is what you were after!
  25. Thanks guys! I decided to do what you suggested and I have a lastclick column in the database now... I'd really like to be able to write a script which would check if the lastclick was within the last 5 minutes (or actually just anything which will calculate how long it was since the last click). This is the script I'm trying to use to work out what the time difference is, but it persists in showing the difference as = 8 no matter what! Can anybody help me sort it out? // Find highest answer number. $sql = "SELECT * FROM players"; $result2=mysql_query($sql) or die(mysql_error()); while ($rows=mysql_fetch_array($result2)){ echo $rows['lastclick']; } $currentdate=date("G:i:s d/m/y"); $difference = $currentdate - $rows['lastclick']; echo $difference;
×
×
  • 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.