Results 1 to 13 of 13

Thread: MySql

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2005
    Posts
    16

    MySql

    How can I update one square of MySql, and not effect the rest..so:

    Code:
    User               Pass               Email          Website                   Logins
    Joe                  hi               blah             none                        1
    Sue                 bye               blah2           google                       1
    Lisa                boo               blah3            none                       1

    When Lisa logs in again how can I change her 1 to a 2, without effecting any other rows or columns? And this forum made the example table look like crap so I guess you have to imagine it -_-
    Last edited by McJedi; Aug 10th, 2005 at 08:36 PM.

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: MySql

    Adding the code tags around the table will make the table look like what you want (I did it for you).


    Has someone helped you? Then you can Rate their helpful post.

  3. #3
    Frenzied Member oceanebelle's Avatar
    Join Date
    Jun 2005
    Location
    my n00k.
    Posts
    1,064

    Re: MySql

    Quote Originally Posted by McJedi
    How can I update one square of MySql, and not effect the rest..so:

    Code:
    User               Pass               Email          Website                   Logins
    Joe                  hi               blah             none                        1
    Sue                 bye               blah2           google                       1
    Lisa                boo               blah3            none                       1

    When Lisa logs in again how can I change her 1 to a 2, without effecting any other rows or columns? And this forum made the example table look like crap so I guess you have to imagine it -_-

    one square??? I'm not so sure... i assume this is a tablename
    so
    Code:
    update tablename set Logins = 2 where User = 'Lisa'
    they shouldn't be any different right?
    BTW, don't have mysql here... but that's basic sql... it should work

  4. #4
    Lively Member
    Join Date
    Aug 2005
    Posts
    65

    Re: MySql

    ???
    Stab in the dark here
    PHP Code:
    $user $_SESSION["user"];
    UPDATE [TABLENAMESELECT User where user '$user' set Logins 2 

  5. #5
    Frenzied Member oceanebelle's Avatar
    Join Date
    Jun 2005
    Location
    my n00k.
    Posts
    1,064

    Re: MySql

    can't simple sql statements do?

  6. #6
    Frenzied Member oceanebelle's Avatar
    Join Date
    Jun 2005
    Location
    my n00k.
    Posts
    1,064

    Re: MySql

    and btw anita.. I have not encountered syntax like that before.

  7. #7
    Junior Member christoph's Avatar
    Join Date
    Aug 2005
    Posts
    23

    Re: MySql

    PHP Code:
    $query "UPDATE tablename SET Logins ='2' WHERE User ='Lisa' LIMIT 1 ";

    mysql_query($query)
     or die (
    "Could not insert data because ".mysql_error()); 
    That'll work.

    -chris
    "Never put off till tomorrow what you can do today" Thomas Jefferson

  8. #8
    Lively Member
    Join Date
    Aug 2005
    Posts
    65

    Re: MySql

    i was basically doing what Christoph was doing

    i think Simple SQL statements only apply in VB

  9. #9
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765

    Re: MySql

    UPDATE MyTable SET Logins = Logins + 1 WHERE User = Lisa


    Yeah, THATS RIGHT, PWNED YOU ALL!

    Sorry

    Edit: And although it could be that your table is just an example, but make sure you store passwords as MD5 hashes, not the raw password.
    Don't Rate my posts.

  10. #10
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    Re: MySql

    Quote Originally Posted by Pc_Madness
    Edit: And although it could be that your table is just an example, but make sure you store passwords as MD5 hashes, not the raw password.
    Well, that's debatable. If I didn't need to retrieve the plan-text password as some future point in time, I would use SHA to generate the hash, (because MD5 has a more likely chance of causing collisions). If I want to store the password in a secure way so that I can retrieve it later, I would use DES or ASE encryption.

  11. #11
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: MySql

    Why would you need to retrieve the plain text password?

    Tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  12. #12
    Frenzied Member oceanebelle's Avatar
    Join Date
    Jun 2005
    Location
    my n00k.
    Posts
    1,064

    Re: MySql

    Quote Originally Posted by Anita101g
    i was basically doing what Christoph was doing

    i think Simple SQL statements only apply in VB

    ???

  13. #13
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: MySql

    Quote Originally Posted by nkad
    Well, that's debatable. If I didn't need to retrieve the plan-text password as some future point in time, I would use SHA to generate the hash, (because MD5 has a more likely chance of causing collisions). If I want to store the password in a secure way so that I can retrieve it later, I would use DES or ASE encryption.
    Collisions? - MD5 is a good way too protect passwords, it takes ages and a lot of processing power to find a string which produces a particular hash, even then there is no guarantee that it is the password, because like you said , some strings produce identical hashes.

    Hashing the password doesn't protect the user from having their account hacked or the hash snooped while it is being transferred over the network, but it does protect the identity of the password.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

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



Click Here to Expand Forum to Full Width