SitePoint Sponsor

User Tag List

Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 54

Thread: Code dosnt work

  1. #26
    SitePoint Zealot rain5017's Avatar
    Join Date
    Sep 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my gud !!!

    Unknown column 'permission' in 'field list'

  2. #27
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    OK forget that, I just saw the last post, check your spelling of permission against what you have in the database.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #28
    Non-Member
    Join Date
    Mar 2005
    Posts
    832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh **** i forgot the field is called perms lol hat would i change to make it perms?

  4. #29
    SitePoint Zealot rain5017's Avatar
    Join Date
    Sep 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Tidal Wave
    oh **** i forgot the field is called perms lol hat would i change to make it perms?
    Yes

  5. #30
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    permission = '$_POST[newpermission]',
    to
    perms = '$_POST[newpermission]',
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  6. #31
    Non-Member
    Join Date
    Mar 2005
    Posts
    832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what and were would i change it so it knows its perms instead of permission

  7. #32
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    exactly what I just put!!!
    perms = '$_POST[newpermission]',

    (in the query)
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  8. #33
    Non-Member
    Join Date
    Mar 2005
    Posts
    832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    says this now and didnt update:

    UPDATE users SET username = 'luke', perms = 'member', opnick = 'none' where username=''Record Updated

  9. #34
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    username=''Record Updated
    means the original username isn't being passed properly.
    Check the field is set up and that the code retrieving it ($_POST['username']) is correct
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  10. #35
    SitePoint Zealot rain5017's Avatar
    Join Date
    Sep 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <form action="addoppro.php" method="post">
    Username: <input type="text" name="newusername" value="<? echo $username; ?>"><br><input type="hidden" name="username" value="<? echo $username; ?>">
    Permission: <input type="text" name="newperms" value="<? echo $perms; ?>"><br>
    Operator Nickname: <input type="text" name="newopnick" value="<? echo $opnick; ?>"><br>
    <input type="Submit" value="Update">
    </form>


    <?
    include "../db_connect.php";
    #include "theme.php";
    $query = "UPDATE users SET username = '$_POST[newusername]', perms = '$_POST[newperms]', opnick = '$_POST[newopnick]' where username='$_POST[username]'";
    echo $query;
    mysql_query($query) or die(mysql_error());
    echo "Record Updated";
    ?>

  11. #36
    SitePoint Zealot rain5017's Avatar
    Join Date
    Sep 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <input type="hidden" name="username" value="<? echo $username; ?>">
    added?

  12. #37
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    Off Topic:


    just as an aside to this ongoing question,
    Using short tags such as <? and <?= will soon be impossible as they are on the list of deprectated items. Try and use <?php and <?php echo instead.

    Mike
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  13. #38
    Non-Member
    Join Date
    Mar 2005
    Posts
    832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    says this

    UPDATE users SET username = 'luke', perms = 'member', opnick = 'None' where username=''Record Updated

  14. #39
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    right, lets start at the beginning!
    How is the form being populated?
    Does the information get to the form from a database record correctly?
    view the source of the page from a browser and see if the hidden field has been set with the correct username.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  15. #40
    Non-Member
    Join Date
    Mar 2005
    Posts
    832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i press view source button and dosnt even pop up fo rsome reason :s

    can u plz give it a try user and password is temp u gotta login at www.ninechat.com/accounts/ninechat then go to http://servers2/accounts/ninechat/admin/addop.php

  16. #41
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    OK, there are no values going to the form at all.
    In order to update this form using the methods shown you will have to set up a query to get the members details from the database based on their login records.
    IE
    PHP Code:
    <?php
    # if the user is logged in as Tidal with the password Wave
    # the login details would either be from your sessions or your cookie variables


    $sql=mysql_query("select * from memberstable where username='Tidal' and password='Wave'") or die(mysql_error());
    $rows mysql_fetch_assoc($sql);

    # now you can populate the form fields
    $username=$row['username'];
    $perms $row['perms'];
    $opnick=$rows['opnick'];
    ?>
    <form action="addoppro.php" method="post"> 
    Username: <input type="text" name="newusername" value="<? echo $username?>"><br><input type="hidden" name="username" value="<? echo $username?>"> 
    Permission: <input type="text" name="newperms" value="<? echo $perms?>"><br> 
    Operator Nickname: <input type="text" name="newopnick" value="<? echo $opnick?>"><br> 
    <input type="Submit" value="Update"> 
    </form>
    Now when the form is sent, the values for username will be passed along with it.

    Cheers

    Mike
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  17. #42
    SitePoint Addict ruchit's Avatar
    Join Date
    Sep 2005
    Location
    miDDle oF NoWHere
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are you submitting old username value through the form? if not, please do (in a hidden field). Alternatively pass the old username as a session variable... and after the query.. update this session variable with the new value... for you to use session variable.. call session_start() before referencing the value in session globals array ($_SESSION).
    work together - make world a better place
    Outsource to India
    Web Design India
    Affordable Webhosting

  18. #43
    Non-Member
    Join Date
    Mar 2005
    Posts
    832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think you got it wrong. This is a page to make it so u type in a username a want to update and text in the perms field so it updates that instead of doing it in phpmyadmin

  19. #44
    Non-Member
    Join Date
    Mar 2005
    Posts
    832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is an admin page to edit user permissions in the perms field

  20. #45
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    I guessed it was but you need a way to define who the member being updated is!
    You could just have 3 text fields
    Username
    New username
    Permissions

    and do it that way.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  21. #46
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by ruchit
    are you submitting old username value through the form? if not, please do (in a hidden field). Alternatively pass the old username as a session variable... and after the query.. update this session variable with the new value... for you to use session variable.. call session_start() before referencing the value in session globals array ($_SESSION).

    Two pages, read the thread, the hidden field is set!
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  22. #47
    Non-Member
    Join Date
    Mar 2005
    Posts
    832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i dont want to change the username i just want the username thing to find that username then change the opnick field for it and the perms field

  23. #48
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    *spike falls over*
    OK type in the username, permissions and nick....
    PHP Code:
    <?
    include "theme.php";
    ?>
    <form action="addoppro.php" method="post">
    Username: <input type="text" name="username"><br>
    Permission: <input type="text" name="permission"><br>
    Operator Nickname: <input type="text" name="opnick"><br>
    <input type="Submit" value="Update">
    </form>  



    addoppro:



    <?
    include "../db_connect.php";
    include 
    "theme.php";

    $perms $_POST['perms'];
    $username=$_POST['username'];
    $onpick $_POST['onpick'];

    $query "UPDATE users SET username = '$username', perms = '$permission', opnick = '$opnick' WHERE username = '$username'";
    mysql_query($query);
    echo 
    "Record Updated";
    ?>
    Mike
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  24. #49
    SitePoint Zealot rain5017's Avatar
    Join Date
    Sep 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by spikeZ
    *spike falls over*
    OK type in the username, permissions and nick....
    PHP Code:
    <?
    include "theme.php";
    ?>
    <form action="addoppro.php" method="post">
    Username: <input type="text" name="username"><br>
    Permission: <input type="text" name="permission"><br>
    Operator Nickname: <input type="text" name="opnick"><br>
    <input type="Submit" value="Update">
    </form>  



    addoppro:



    <?
    include "../db_connect.php";
    include 
    "theme.php";

    $perms $_POST['perms'];
    $username=$_POST['username'];
    $onpick $_POST['onpick'];

    $query "UPDATE users SET username = '$username', perms = '$permission', opnick = '$opnick' WHERE username = '$username'";
    mysql_query($query);
    echo 
    "Record Updated";
    ?>
    Mike
    I think you make an error.

    if $username was changed,then $username was not the username in database

  25. #50
    SitePoint Addict ruchit's Avatar
    Join Date
    Sep 2005
    Location
    miDDle oF NoWHere
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in that case just remove username='$newusername' part from the query and just use the hidden username field and not text box for submitting username.

    Note to spikeZ... guess i did it again... probably we both had the same idea... just that ur msg got published before me... sorry again mate!
    work together - make world a better place
    Outsource to India
    Web Design India
    Affordable Webhosting


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •