Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by MargateSteve

  1. date_default_timezone_set('America/New_York'); $date = date('Y-m-d H:m'); echo "It is now $date";
  2. No. I tried out the code for the ones I understood. Which was more in the tens than the thousands! And in all fairness, I only went back as far as 2008.
  3. My technique was basically to look through every post in this forum and try out the posted code for scenario's I understood! I then changed part of the code to see what changed in the output. I also found the basic tutorials on Tizag useful as a starting point. Steve PS. I never brought any brownies in and now feel guilty. Where should I send them?
  4. Perfect as always! As for the alphabetical order, once I added more folders I noticed that it is sorted alphabetically anyway! Thanks Steve
  5. I am using the code below to select a folder for an image upload. It works fine in that it does show all of the sub folders of the images folder but the first two options in the dropdown are . and .. I am not sure where they are coming from (although they do make me think of 'up one level' and 'go to top level option's) but cannot work out how to remove them. Also, I have been searching for a way to list the folders alphabetically but am stuck on that too! Thanks in advance for any suggestions Steve $dirs = scandir('/path/to/images'); foreach ($dirs as $dir) { if (is_dir('/path/to/'.$dir)) { echo '<option value="'.$dir.'">'.$dir.'</option>'; } }
  6. The way I normally tackle this (with psuedo code and ignoring the rest of the code is <select name='chixcutlet' > <option value='$valueoptions' <?php if ($valueoptions = $savedvalue) {echo 'selected '}> $name </option> ?> </select>
  7. I tried it again and it threw up a MySQL error on that part, so I tried again but wrapped the NULL in the code you provided in single quotes $hg = isset($_POST['homegoals']) && ctype_digit($_POST['homegoals']) ? (int) $_POST['homegoals'] : 'NULL'; Now it works perfectly. All that is left is for me to understand what it is doing! My assumption is.... $hg = isset($_POST['homegoals']) && ctype_digit($_POST['homegoals']) Checks if the field is set and if it is set is it a number? ? (int) $_POST['homegoals'] If it is a number, insert the field : 'NULL'; If not set or not a number, enter NULL Thanks for the help. Steve
  8. So if I used your code with home_goals = $hg in the query string it should work? It is late now and am off to bed but will give that a go in the morning. Thanks Steve
  9. The actual field is DEFAULT NULL and when a new entry is made it shows up as null. There is no need to put a zero in on INSERT as the fields are intended to be initally blank (they are soccer fixtures and will remain blank until the game is played) so I have only tested it via UPDATE. I have actually come up with a solution that is far from elegant but does the job.... if(!empty($_POST['homegoals'])) { $hg = "'".$_POST['homegoals']."'"; } else if ($_POST['homegoals'] == '0') { $hg = '0'; } else { $hg = 'NULL'; } **SNIPPED OTHER POST TESTS** $thismatch = $_POST['match']; mysql_query ( " UPDATE all_games SET home_goals = " .$hg. ", away_goals = " .$ag. ", attendance = " . $att . " WHERE all_games_id = '".$thismatch."' ") or die(mysql_error()); header("Location: matchupdate.php?thedate=".$_POST['date'].""); }
  10. That did not work unfortunately, unless I have tried to use it in the wrong context. Whether I leave the field blank, or enter a zero, it still enters a zero into the table. $hg = isset($_POST['homegoals']) && ctype_digit($_POST['homegoals']) ? (int) $_POST['homegoals'] : NULL; $thismatch = $_POST['match']; mysql_query ( " UPDATE all_games SET home_goals = ' " .$hg. " ' WHERE all_games_id = '".$thismatch."' ") or die(mysql_error()); header("Location: matchupdate.php?thedate=".$_POST['date']."");
  11. I have got another of those problems that should be easy to solve but I cannot get my head round it! I have a form to enter data into a table and one of the fields can be left blank. However, I'd data is entered in the field it can be a Zero. This is leaving me a problem as I cannot find a way to get the script to insert NULL if the field is blank but actually put the Zero in if that is what is entered. I have tried several permutations of nested if's using empty or isset, but whatever I try, the same result is inserted in both scenarios. The arguments I need to pass are...... If field is empty INSERT null If field is 0 INSERT 0 If field is not empty and not 0 INSERT field Thanks in advance for any suggestions. Steve
  12. I am trying to create a soccer results matrix from an existing database (tables and current query are at the bottom of the post) and am not sure where to start with it. It is a bit hard to explain (unless you are a soccer fan where these results matrix's or grids are very common) but will give it a go! Basically, I need to create a grid where the rows relate to the Home Teams and the columns relate to the Visiting Teams. In the corresponding cell I need to put the score of that game (I will also want to put in the date if the game has not been played but should be able to sort that once I have the basics sorted). For example, if the result of a game was United 2 City 0, the cell of the United row and the City column should show 2-0. An example of what I am trying to achive can be found at http://en.wikipedia.org/wiki/2009%E2%80%9310_Premier_League#Results. As I said, I already have an existing database that I want to use and have an idea how it should work but really need a starting point on how to go about it. My guess is that it would need to loop through the Home Teams (alphabetically is standard for these grids) and for each Home Team then loop through the Away Teams and then place the correct result in that cell for the game where the two teams match. If the Home Team = Away Team then something else needs to be shown (usually an X or preferably a black cell) as a Team cannot play itself. Any suggestions on how I could start this would be greatly appreciated. Thanks in advance Steve The tables and sample data (these are not the full tables, just the relevant fields) CREATE TABLE `all_games` ( `all_games_id` int(11) NOT NULL auto_increment, `date` date default NULL, `time` time default NULL, `home_team` int(11) NOT NULL default NULL, `away_team` int(11) NOT NULL default NULL, `home_goals` int(11) default NULL, `away_goals` int(11) default NULL, PRIMARY KEY (`all_games_id`) ) INSERT INTO `all_games` VALUES (1, '2009-08-15', '15:00:00', 19, 42, 4, 0); INSERT INTO `all_games` VALUES (2, '2009-08-18', '19:45:00', 42, 29, 0, 4); INSERT INTO `all_games` VALUES (3, '2009-08-22', '15:00:00', 42, 30, 2, 1); INSERT INTO `all_games` VALUES (4, '2009-08-24', '19:45:00', 1, 42, 0, 3); INSERT INTO `all_games` VALUES (5, '2009-08-29', '15:00:00', 11, 42, 3, 0); CREATE TABLE `teams` ( `team_id` int(11) NOT NULL auto_increment, `team_name` varchar(45) collate latin1_general_ci default NULL PRIMARY KEY (`team_id`) ) INSERT INTO `teams` VALUES (1, 'Aveley'); INSERT INTO `teams` VALUES (2, 'Billericay Town'); INSERT INTO `teams` VALUES (3, 'Bury Town'); INSERT INTO `teams` VALUES (4, 'Canvey Island'); INSERT INTO `teams` VALUES (5, 'Carshalton Athletic'); The query I currently use to show the result of the game eg (in pseudo code)... showdate ' ' HomeTeam ' ' home_goals ' ' AwayTeam ' ' away_goals would show Monday, 26th December 2011 United 2 City 0 SELECT *, DATE_FORMAT(`time`,'%l:%i%p ') AS showtime, DATE_FORMAT(`date`,'%W, %D %M %Y') AS showdate, HT.team_name as HomeTeam, VT.team_name as AwayTeam, FROM all_games JOIN teams as HT ON all_games.home_team = HT.team_id JOIN teams as VT ON all_games.away_team = VT.team_id WHERE all_games.home_team IS NOT NULL
  13. I recently got some help over in the PHP Coding forum to help edit multiple records as selected with checkboxes. Everything works fine as standard but I have thrown another spanner in the works that, as I think it is javascript related, I have not got a clue how to resolve. I have added the tablesorter script which allows me to, well, sort tables! The sorting part works fine but once I have used it, it then will not pass the checkbox values onto the next page/script. The page in question is HERE. It is on a non-production database so it is fine for people to actually test it. If I try to pass the records before sorting anything it works perfectly. However, as soon as I have clicked to sort any column, even one that is already sorted in the right order, it will not pass any checkbox values. However, after sorting, if I try to edit one record, via the pencil icon on the page, it works perfectly. This suggests to me that something happens during the javascript process that stops the values being passed as an array. The link to the script itself is http://autobahn.tablesorter.com/jquery.tablesorter.js. The code I have used is INITIALISATION CODE <script> $(document).ready(function() { $("#myTable").tablesorter({ headers: { 0: { sorter: false }, 7: { sorter: false } } }); }); </script> THE LISTING AND FORM (memberlist.php) <table id="myTable" class="tablesorter"> <thead> <tr> <th></th> <th>ID</th> <th>USERNAME</th> <th>FIRST NAME</th> <th>LAST NAME</th> <th>EMAIL</th> <th>ACTIVE?</th> <th></th> </tr> </thead> <tbody> <form name="form1" method="post" action="membermultiupdate.php"> <?php while ($rowmembers = mysql_fetch_assoc($members)) {echo ' <tr> <td><input name="membid[]" type="checkbox" id="membid[]" value="'.$rowmembers['id'].'"></td> <td>'.$rowmembers['id'].'</td> <td>'.$rowmembers['username'].'</td> <td>'.$rowmembers['first_name'].'</td> <td>'.$rowmembers['last_name'].'</td> <td>'.$rowmembers['email'].'</td> '; if ($rowmembers['active'] == 1) {echo '<td> YES </td>';} else {echo ' <td>NO </td>';} echo ' <td><a href="memberedit.php?member='.$rowmembers['id'].'"><img src="http://icons.iconarchive.com/icons/custom-icon-design/office/256/edit-icon.png" width="15" height="15" /></a> <img src="http://icons.iconarchive.com/icons/custom-icon-design/office/256/delete-icon.png" width="15" height="15" /></td> </tr>';} ?> </tbody> </table> <table><tr> <td colspan="4" align="center"><input type="submit" name="submit" value="Update Selected"></td> </tr> </form></table> THE RECEIVING SCRIPT (membermultiupdate.php) if (isset ($_POST['submit'])) { if (is_array ($_POST['membid'])) { $updateIDs = implode(', ', array_filter(array_map('intval', $_POST['membid']))); $query = "SELECT * FROM users WHERE id IN ({$updateIDs})"; $members = mysql_query($query); $count=mysql_num_rows($members); } } Any advice or pointers would be greatfully received! Thanks in advance Steve
  14. I am not sure if magic_quotes_gpc is enabled and looking through the hosts FAQ (1&1 shared hosting) there is no indication one way or the other. I will look more into that when I get home. If I have read your post correctly, there is no need to sanitize at the point of collecting the data from the form and it is only necessary at the point of inserting it into the database IF no secure validation has been done on the data? Having said that and if I am correct, it would not be a bad idea to sanitize the inserted data anyway just to get into the habit of it? Thanks Steve
  15. Huge thanks. This is now working absolutely perfectly and has also introduced me to foreach loops! The final code is below, admittedly without sanitization as it is 1.30am and I am off to bed and it is still on my learning list! However, I have made an attempt at validating data and sanitizing it simply with mysql_escape_string and stripslashes (although I may be missing the point there) on the registration form and have put that code at the bottom of this post. Admittedly it is not the tidiest code and is heavily commented so I know what is what as I go along but at this moment it works and my only real concern is if mysql_escape_string and stripslashes give enough safeguards. Thanks again Steve The Update Script foreach($_POST['username'] as $id => $username) { $firstName = $_POST['first_name'][$id]; $lastName = $_POST['last_name'][$id]; $email = $_POST['email'][$id]; //run update query $sql1="UPDATE users SET username='".$username."', first_name='".$firstName."', last_name='".$lastName."', email='".$email."' WHERE id='".$id."'"; $result1=mysql_query($sql1); } Registration script with validation if(isset($_POST['sent']) && $_POST['sent'] =="yes" ) {//The form was submitted so check data {//START INPUT CHECKS #USERNAME if (empty($_POST['name']))//Check for Username {//Username is empty $regmsg .= 'Username must be entered<br />'; $namevalid = 1; } else {//Username is posted //Get the Username $name = mysql_escape_string($_POST['name']); //Is the Username alphanumeric and between 6 & 10 characters? if (!preg_match("/^[a-z0-9_]{6,10}+\z/i",$name)) {//Username is not alphanumeric $regmsg .= 'Usernames must be between 6 & 10 characters and can only contain letters, numbers and _.<br />'; $namevalid = 1; } else {//Username is alphanumeric so check if it already exists $usersearch = mysql_query('SELECT username FROM users WHERE username="'.$name.'"') or die(mysql_error()); $usermatch = mysql_num_rows($usersearch); //Specify error message if Username is already in use if($usermatch > 0) { $regmsg .= 'Username already in use'; $namevalid = 1; } } } #EMAIL if (empty($_POST['email']))//Check for Email {//Email is empty $regmsg .= 'Email must be entered<br />'; $emailvalid = 1; } else {//Email is posted // Get the email address $email = mysql_escape_string($_POST['email']); //Is the email address in a correct format? if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {// email is not an email address $regmsg .= 'The email you have entered is invalid.<br />'; $emailvalid = 1; } else {//Email is a valid address so check if it already exists $emailsearch = mysql_query('SELECT email FROM users WHERE email="'.$email.'"') or die(mysql_error()); $emailmatch = mysql_num_rows($emailsearch); //Specify error message if Email is already in use if($emailmatch > 0) { $regmsg .= 'An account has already been registered with that email address.<br />'; $emailvalid = 1; } } } #FIRST NAME if (empty($_POST['first_name']))//Check for First Name {//First Name is empty $regmsg .= 'First Name must be entered<br />'; $fnamevalid = 1; } else {//First Name is posted //Get the First Name $fname = stripslashes($_POST['first_name']); //Does the First Name only contain letters, spaces, - or '? if (!preg_match("/^[a-z\\' -]+\z/i",$fname) || substr_count($fname, "'") > 1 || substr_count($fname, "-") > 1) {//First Name is not valid $regmsg .= 'First Names can only contain letters, spaces, \' and _.<br />'; $fnamevalid = 1; } } #LAST NAME if (empty($_POST['last_name']))//Check for Last Name {//Last Name is empty $regmsg .= 'Last Name must be entered<br />'; $lnamevalid = 1; } else {//Last Name is posted //Get the Last Name $lname = stripslashes($_POST['last_name']); //Does the Last Name only contain letters, spaces, - or '? if (!preg_match("/^[a-z\\' -]+\z/i",$lname) || substr_count($lname, "'") > 1 || substr_count($lname, "-") > 1) {//Last Name is not valid $regmsg .= 'Last Names can only contain letters, spaces, \' and _.<br />'; $lnamevalid = 1; } } #PASSWORDS if (empty($_POST['password']) OR empty($_POST['password2']))//Check for Passwords {//At least one Password field is empty $regmsg .= 'Both password fields must be entered<br />'; $passvalid = 1; } else {//Both Passwords are posted $password = mysql_escape_string($_POST['password']); $password2 = mysql_escape_string($_POST['password2']); //Is the first Password alphanumeric and does the second one match? if (!preg_match("/^[a-z0-9]{6,10}+\z/i",$password) OR !preg_match("/^[a-z0-9]{6,10}+\z/i",$password2)) { $regmsg .= 'Passwords must be alphanumeric and between 6 & 10 characters long.<br />'; $passvalid = 1; } if($password <> $password2) { $regmsg .= 'Your Passwords do not match.<br />'; $passvalid = 1; } } }//END INPUT CHECKS if (($passvalid !=1) AND ($namevalid !=1) AND ($fnamevalid !=1) AND ($lnamevalid !=1) AND ($emailvalid !=1) AND ($passvalid !=1)) {//Everything is valid so insert user mysql_query ( "INSERT INTO users (username, first_name, last_name, password, email, hash, register_date, userlevel) VALUES ( '". mysql_escape_string($name) ."', etc.............
  16. That's a bad habit I got into initially and keep forgetting to get out of! Thanks to the suggestion you posted the page is half working! The code below brings the right records into the form on the update page, but I am having trouble getting the update to work. if (isset ($_POST['submit'])) { if (is_array ($_POST['membid'])) { $updateIDs = implode(', ', array_filter(array_map('intval', $_POST['membid']))); $query = "SELECT * FROM users WHERE id IN ({$updateIDs})"; $members = mysql_query($query); } } I have looked through a lot of tutorials and examples, some using foreach loops and some using counters as well as the phpfreaks tutorial but have not got anything to work. The only time anything I tried did anything to the records was when it deleted all fields in all rows! I will start on the quest again after work but not sure which method would be the best way to go? Thanks Steve
  17. Taking out the mysql_real_escape_string() worked perfectly thanks. The update itself is not working but that is a problem to look at when I get home tonight. Thanks again Steve BTW in the 'real' code the checkboxes are actually named 'membid'. I only changed them briefly as I though it would make my posted code easier to understand!
  18. I have got myself a bit confused whilst trying to create an 'update selected records' page. In memberlist.php, a set of records is shown, each with a checkbox. When the user clicks on 'Update Selected' it opens up membermultiupdate.php. I cannot get this page to recognise which id's have been passed and put them in an array so only the checked records are shown. The page in question is at http://www.margate-fc.com/memberlist.php. When it opens membermultiupdate.php, there are currently 2 errors.... Warning: implode() [function.implode]: Invalid arguments passed in /homepages/46/d98455693/htdocs/membermultiupdate.php on line 11 which refers to $update = implode ("','", mysql_real_escape_string ($_POST['checkbox'])) Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /homepages/46/d98455693/htdocs/membermultiupdate.php on line 44 which is while ($rowmembers = mysql_fetch_array($members)) I have also tried mysql_fetch_assoc there too. I may be miles out or I may be missing something simple but I have tried for hours now to get my head around this and have not even got to the point where I can see if the actual update side works! Any suggestions would be greatly received and I have put the relevant code from both pages below. Thanks in advance for any help or suggestions Steve memberlist.php The query to get all rows $members = mysql_query(" SELECT * FROM users"); The submit form with checkboxes <form name="form1" method="post" action="membermultiupdate.php"> <?php while ($rowmembers = mysql_fetch_assoc($members)) {echo ' <tr> <td><input type="hidden" name="id[]" value="'.$rowmembers['id'].'" />'.$rowmembers['id'].'</td> <td><input name="checkbox[]" type="checkbox" id="checkbox[]" value="'.$rowmembers['id'].'"></td></td> <td>'.$rowmembers['id'].'</td> <td>'.$rowmembers['username'].'</td> <td>'.$rowmembers['first_name'].'</td> <td>'.$rowmembers['last_name'].'</td> <td>'.$rowmembers['email'].'</td> '; if ($rowmembers['active'] == 1) {echo '<td> YES </td>';} else {echo ' <td>NO </td>';} echo ' <td><a href="memberedit.php?member='.$rowmembers['id'].'"><img src="http://icons.iconarchive.com/icons/custom-icon-design/office/256/edit-icon.png" width="15" height="15" /></a> <img src="http://icons.iconarchive.com/icons/custom-icon-design/office/256/delete-icon.png" width="15" height="15" /></td> </tr>';} ?> <tr> <td colspan="4" align="center"><input type="submit" name="submit" value="Update Selected"></td> </tr> </form> membmultiupdate.php The code bit to try to show all checked rows if (isset ($_POST['submit'])) { if (is_array ($_POST['checkbox'])) { $update = implode ("','", mysql_real_escape_string ($_POST['id'])); $members = mysql_query("SELECT * FROM users WHERE id IN (".$update.") "); } } The form to show all of the checked rows <form name="form1" method="post" action=""> <?php while ($rowmembers = mysql_fetch_array($members)) {echo ' <tr> <td width="200px" align="right" style="font-weight:bold"> <label for="name">Username:</label> </td> <td width="200px" > <input type="text" name="name" value="'.$rowmembers['username'].'" /><br> </td> </tr> <tr> <td width="200px" align="right" style="font-weight:bold"> <label for="name">First Name:</label> </td> <td width="200px" > <input type="text" name="first_name" value="'.$rowmembers['first_name'].'" /><br> </td> </tr> <tr> <td width="200px" align="right" style="font-weight:bold"> <label for="name">Last Name:</label> </td> <td width="200px" > <input type="text" name="last_name" value="'.$rowmembers['last_name'].'" /><br> </td> </tr> <tr> <td width="200px" align="right" style="font-weight:bold"> <label for="name">Email:</label> </td> <td width="200px" > <input type="text" name="email" value="'.$rowmembers['email'].'" /><br> </td> </tr>' ;} ?> <tr> <td colspan="4" align="center"><input type="submit" name="update" value="update"></td> </tr> </form> The code to update the rows from the above form and the return to memberlist.php if($update) { foreach($_POST['id'] as $id) { $sql1=" UPDATE users SET username='".$_POST["name".$id]."' , first_name='".$_POST["first_name".$id]."' , last_name='".$_POST["last_name".$id]."' , email='".$_POST["email".$id]."' , ONOFF='".$_POST["ONOFF".$id]."' WHERE id='".$id."'"; $result1=mysql_query($sql1); } } if($result1){ header("location:memberlist.php"); }
  19. I have found a fairly generic script for refreshing the content of a div without refreshing the whole page and although it works fine, there are a few things I would like to improve on if they are possible. <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function() { $("#refreshdiv").load("activity.php"); var refreshId = setInterval(function() { $("#refreshdiv").load('activity.php?randval='+ Math.random()); }, 9000); $.ajaxSetup({ cache: false }); }); </script> <div id="refreshdiv"> </div> There are, in all, 6 divs that I am looking to refresh. 3 of them show on every page and the other 3 are all on the same page (giving a total of 6 on that page) and my 3 questions are....... 1. All of the divs are pulling results from a MySQL db, via Php, and what I have had to do for now is set up a new page for each of the divs content and have them pulled into the requesting page, resulting in 6 new pages. Is there a way that I can keep the content all on the one page and have Ajax refresh the query/result within the div tags instead of loading/reloading an external page. I assume that the '.load' section may be the key to this. My guess is that it would be possible to write a function that would do this but am not sure where to start. 2. At the moment, there are 6 different scripts to allow the refresh of 6 different divs. Is there a way to cover all 6 divs in one script? I would assume that I could name all the divs the same but if question 1 is not achievable, then I will still have to call 6 different pages within the script. I would imagine that I could wrap the whole page in a refreshing div but would guess that is not recommended. 3. This may be one for the php forum but I will give it a go anyway. I have been playing around with setting up a page view counter and it works fine with the following code $stamp = date('Y-m-d H:i:s'); $page = $_SERVER['REQUEST_URI']; $page_view = mysql_query (" SELECT * FROM page_views WHERE url = '$page' "); $page_view_match = mysql_num_rows($page_view); $page_view_row = mysql_fetch_assoc($page_view); if($page_view_match > 0) { mysql_query("UPDATE page_views SET member_views = member_views +1, last_member = '".$stamp."' WHERE url = '$page'" ) or die(mysql_error()); } else { mysql_query ( "INSERT INTO page_views (url, member_views, last_member) VALUES ( '".$page."', '1', '".$stamp."' )" ) or die(mysql_error()); } On first page load, it correctly creates/updates 'path/to/file.php'. On the ajax reload it always adds a new record with a random number like 'path/to/file.php?randval=0.6086456351913512&_=1316338620227'. I have tried taking out the '?randval='+ Math.random()' part and it left 'path/to/file.php?_=1316338620227' which, I guess, may be a time stamp. I need it to ignore anything from randval onwards to make sure it only enters the initial page view into the table and not every Ajax reload of a div. I have tried pre-empting the above code with $path = $_SERVER['REQUEST_URI']; $pos = stripos($path, '/randval=/'); if ($pos>0) { to try to make it ignore any Ajax reloads but it does not work. So going back to the original Ajax script, would it be possible to set a counter variable to zero on page load and increment it on any reload? That way, I can tell the php script to only update the page views when the counter is zero. I know this sort of thing would be possible in php alone but as I am having trouble getting php to recognise that I want the 'randval=' part of the code ignored, I am not sure where to go now! Thanks in advance for any help. Steve
  20. I think I understand what you are saying here. Upon logging in, a field in the db can be updated with a key, that key can also be placed in the cookie and the user/password can be selected from the database where the keys match? If I have understood it, how would I get it to generate a unique key each time? Using rand would (although unlikely) run the risk of generating two or more identical keys.
  21. I can understand the logic behind that. If a user has deleted is cookies, there would still be a good chance that the user could still be automatically logged in via the details in the db.
  22. I didn't think about using the db to store data regarding the 'Remember Me' function. I assumed it would all be stored in cookies. Once I start on the login part if my script I will have a better look at that. Would I be right to presume that is no standard 'best practice' for this and it would be down to whichever I get on with best?
  23. I am about to attempt to write my first php script from scratch after a year or so of copying and adapting code. I am going to do a registration/login in system and thinking ahead, want to make sure that once someone is logged in, this information is passed from page to page (so they do not have to log in again on each page) and I would also like to provide a 'Remember Me' option. I have had a read up and from what I gather, sessions would be better for showing someone is logged in from page to page and cookies would be the only way to implement a 'Remember Me'. Would this be the best way to approach this or is/are there better ways? Thanks in advance Steve
  24. I have searched for a solution to this but as I am not quite sure what I am searching for (as the title may prove) I have had no joy. The term I have used is the way it is described in PHPMaker. What I am looking to do, is allow a user to select an option, via a drop down menu populated from a MySQL table, but if the option is not there, they can then add the option without having to refresh the page. As a rough example, if I had a dropdown that allowed users to select their country, the database table may have id country 1England 2Scotland 3Wales If a user was from Ireland, I would like them to click on an 'Add Country' button, fill in a form on the same page, and on submitting, the option would be added to the table and appear in the dropdown. If anyone can explain what term I need to search for, I would be grateful. Thanks in advance Steve
  25. Absolutely. I have set up a page to show all the results that are being shown at http://www.margate-fc.com/views.php. The first column shows the views exactly as I posted back at the start of the thread and there is no date clause in the query. This shows all records. The second column also shows the views exactly as I posted back at the start but there is a date clause in the query. This returns some results but not all. The third column has an added "AND date BETWEEN '2010-07-01' AND '2011-06-30' " in both views and no date clause in the query. This shows almost the correct results although the first person with '-24.0000' shouldn't be there. Steve
  • 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.