Jump to content

Ell20

Members
  • Posts

    337
  • Joined

  • Last visited

    Never

Everything posted by Ell20

  1. Thanks alot, had to change the first query varaible to password = PASSWORD('$oldpassword')" but its working now, thanks alot for your help Elliot
  2. Latest 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 'hello')'' at line 1 Cheers
  3. Sorry got confused with the variable name. $uid is the user_id of the user who is logged in: $uid = $_SESSION['user_id'];
  4. $uid is a function which get the details for the user logged in. An error occured in script c:\program files\easyphp1-8\www\html\personal.php on line 170: Undefined variable: password Line 170: $password = mysql_query("SELECT password FROM users WHERE user_id = '$uid' and password = PASSWORD('$password')")
  5. <?php if (isset($_POST['submit2'])) { $oldpassword = escape_data($_POST['oldpassword']); $newpassword = escape_data($_POST['newpassword']); $confirmnew = escape_data($_POST['confirmnew']); $password = mysql_query("SELECT password FROM users WHERE user_id = '$uid' and password = PASSWORD('$password')") OR DIE(mysql_error()); if ($oldpassword == $password) { if ($newpassword == $confirmnew) { $update = "UPDATE users SET password='$confirmnew' where user_id='$uid'" or die(mysql_error()); mysql_query($update) or die(mysql_error()); echo '<h3>Password Changed!</h3>'; } else { echo '<h3>New password and confirmed password to not match</h3>'; } } else { echo '<h3>Current passwords do not match</h3>'; } } ?> Thanks
  6. I use it because I have only been doing PHP for 1 week and that is just what I saw from the book I was learning from. Not everyone is a professional. Elliot
  7. The query you have give me gives a result of Resource id #9 which wont work for this situation? When the user types in the current password to see if the password matches that in the DB it is not encrypted as it never enters the DB its just a variable used to check whether the 2 match. Im getting confused about this now, I have the rest of the code in place to check they all match, I just cant get the current password to match what is the in the database! Cheers
  8. Im affraid I still cant do it. All I want to do is take the password value from the users table and store it in variable $password in its normal form? Cheers
  9. Hey, Im working on a change password.php. I want the user to have to type in there original password then there new password, followed by the confirmed new password. I have pretty much written the code to do this however the password which is stored in the database is encryped using PASSWORD ('$password') at registration. This means that when I attempt to match the password in the database with the current password they do not match. How can I do this? I assume it must be something to do with how the current password is retrieved from the database so here is my code to retrieve the password from the database: $password = mysql_query("SELECT password FROM users WHERE user_id = '$uid'") OR DIE(mysql_error()); $row = mysql_fetch_assoc($password); $password = $row['password']; I displayed the contents of what each variable contained to check and this is what I was given: Passowrd in DB: 37e455b94f62fb0d Current password to match password in DB: comps10 Typed in new password: hello Confirmation of password typed in: hello Cheers
  10. I guess there is no way in which to enter nothing or NULL into the database so that when data is retrieve the space will be blank? Thanks for any help
  11. Google is your friend: http://devzone.zend.com/manual/migration5.functions.html
  12. Anyone got any ideas? Cheers
  13. Thats exactly my point. I dont always want it to be set. Not every player can be the captain of the team. I can solve the problem by adding the alternative selection box "No" however I am trying to avoid having No written all over my table. Id like it to look like this: Rather than this (nice artwork I no, but I think you see my point?): Cheers
  14. Sorry, Line 238 is: $captain = escape_data($_POST['captain']);
  15. This is the part of the form where they select whether the player is any of the following: <tr> <td> Captain: </td> <td> <input type="checkbox" name="captain" value="Yes" /> </td> </tr> <tr> <td> Vice Captain: </td> <td> <input type="checkbox" name="vicecaptain" value="Yes" /> </td> </tr> <tr> <td> Wicketkeeper: </td> <td> <input type="checkbox" name="wicketkeeper" value="Yes" /> </td> </tr> This is the code to insert the results into the database: <?php if (isset($_POST['submit2'])) { $captain = escape_data($_POST['captain']); $vice_captain = escape_data($_POST['vicecaptain']); $wicketkeeper = escape_data($_POST['wicketkeeper']); $name = $_POST['fixturedrp3']; $fixture_id = $_POST['fixturedrp2']; /* If other is selected from drop down box take value from text box */ if($_POST['fixturedrp3'] == 'Other') { $name = $_POST['textboxother']; } /* If other is selected from drop down box and no value put into text box display error */ if($name == "") { echo '<h3>If you select Other, you must type in a player name</h3>'; include ('includes/footer.html'); exit(); } $query = "INSERT INTO team_selection (club_id, fixture_id, player_name, captain, vice_captain, wicket_keeper) VALUES ('$id', '$fixture_id', '$name', '$captain', '$vice_captain', '$wicketkeeper')"; $result = @mysql_query ($query); if ($result) { echo '<h3>Player Added To Team Selection!</h3>'; } } }}}}} ?> As I was saying if the player is not captain etc it gives the following error: An error occured in script c:\program files\easyphp1-8\www\html\teamselection.php on line 238: Undefined index: captain Cheers
  16. Hey guys, Ive created a team selection page for a sports club. When you add a player to the team selection I have created selection boxes to ask whether the player selected is: Captain, Vice-Captain Or Wicketkeeper. However when I display my results on the form I dont want No,No written over the page if they are not Captain etc, I just want a blank space. This however is causing problems when the information is being stored in the database because the variable does not exist if the value is not selected e.g they are not captain etc. How can I get around this problem? Cheers
  17. Thank you, sorry im still learning PHP, i tried deleting part of the '" but it gave a parse error, didnt realise I could remove the { } as well Thanks
  18. Sorry forgot to add that: <?php if (isset($_POST['submit'])) { $fixtureselected = "'{$_POST['fixturedrp']}'"; echo $fixtureselected; } ?>
  19. Hey, I have a small error in my code but im still learning PHP so im not sure what the solution is: <?php if (isset($_POST['submit'])) { $query = "SELECT * FROM team_selection WHERE fixture_id = '$fixtureselected'" or die(mysql_error()); $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_assoc($result)) {?> <table border="1"> <tr> <td> Player: </td> <td> <?=$row['player_name']?> </td> </tr> </table> <?php }} ?> 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 '1''' at line 1 Thanks for your help Elliot
  20. Ell20

    PHP Help

    Hey guys, Im working on a sports club website. I have in place already fixtures and teams for a particular club. Now id like to be able to select players to play in each fixture. I have created a teamselection.php page which I have created a dynamic drop down box to list all the fixtures that are linked to the club which the user is logged into. From here, once the user has selected the fixture, I want to create a list of the players currently selected as playing in that game. For this I have created a new table called team_selection which will be used to store the players that are playing in each fixture. Here is my code so far: <table width="60%" align="center" cellpadding="0" cellspacing="0" border="0" class="game"> <tr> <th colspan="2"> Team Selection </th> </tr> <tr> <td width="63%"> <b> Select Fixture You Wish To View Team Selection For: </b> </td> <td align="center"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <select name="fixturedrp"><option value='' selected disabled>Select Fixture</option> <?php $sql = "SELECT * FROM fixtures WHERE club_id = '$id'"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ $fixture_id = $row["fixture_id"]; $team = $row["team"]; $opponents = $row["opponents"]; $fixture = "$team Vs $opponents"; ?> <option value="<?php echo $fixture_id ?>"><?php echo $fixture ?></option> <?php } ?> </select> </td> </tr> <tr> <td width="63%"> </td> <td align="center"> <input name="submit" type="submit" value="Select Fixture" /> </form </td> </tr> </table> How would I go about the adding players to the fixture? Cheers
  21. Ell20

    CSS Help

    Just been playing around with it a bit more, I have it working properly now in the sense that the text appears in the correct location, however is there some way in which this can be centered? Its all very well using left:150px; but depending on how long the text is varies on how much it looks "aligned: center"? Cheers for your help
  22. Ell20

    CSS Help

    Hey thanks for your help, you understood correctly, however I cant get it to work. My CSS file is called via another file which I have called into the page using: include_once ('includes/header.html'); I no this should be calling fine as I have other CSS stuff that edits the tables, which is working fine. Then in the CSS file I added that you suggested just to check it was working but it had no effect on the positioning of the text, I tried changing the numbers but still nothing. This is an example of the code from which I want to reposition the text: $query = "INSERT INTO cricket_teams (club_id, team_name, captain, vice_captain, description) VALUES ('$id', '$team_name', '$captain', '$vice_captain', '$description')"; $result = @mysql_query ($query); if ($result) { echo '<h3>New Team Created!</h3>'; } } Thanks for your help
  23. Ell20

    CSS Help

    Hi, Is there anyway in which I can define the location of say <h1> so that when ever I use <h1></h1> it appears in a certain location? If this is not possible is there anyway in which I can create a tag which when used displays the text into a desired position? Im not at all familiar with CSS so I have no idea how this works, would I need to call in the CSS page? Cheers for your help Elliot
  24. Do any of these editors automatically align your code for you? I have done some C++ programming before and there was a button you could use to align the braces correctly for you, however im using dreamweaver to code PHP and havent managed to find a way to do that. Cheers
  25. Ell20

    Text Area Tags

    I guess it isnt possible to do this then? What I want to do is to created clickable words such as Bold, which when clicked adds the tags relating to that tag in the text area so the user dosent have to type them in.
×
×
  • 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.