|
-
Aug 10th, 2005, 07:08 PM
#1
Thread Starter
Junior Member
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.
-
Aug 10th, 2005, 08:03 PM
#2
-
Aug 10th, 2005, 11:48 PM
#3
Re: MySql
 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
-
Aug 11th, 2005, 03:20 AM
#4
Lively Member
Re: MySql
???
Stab in the dark here
PHP Code:
$user = $_SESSION["user"];
UPDATE [TABLENAME] SELECT User where user = '$user' set Logins 2
-
Aug 11th, 2005, 03:39 AM
#5
Re: MySql
can't simple sql statements do?
-
Aug 11th, 2005, 03:41 AM
#6
Re: MySql
and btw anita.. I have not encountered syntax like that before.
-
Aug 11th, 2005, 03:59 AM
#7
Junior Member
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
-
Aug 11th, 2005, 04:05 AM
#8
Lively Member
Re: MySql
i was basically doing what Christoph was doing
i think Simple SQL statements only apply in VB
-
Aug 11th, 2005, 04:47 AM
#9
PowerPoster
-
Aug 11th, 2005, 10:30 AM
#10
Fanatic Member
Re: MySql
 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.
-
Aug 11th, 2005, 11:23 AM
#11
Re: MySql
Why would you need to retrieve the plain text password?
Tg
-
Aug 11th, 2005, 07:21 PM
#12
Re: MySql
 Originally Posted by Anita101g
i was basically doing what Christoph was doing
i think Simple SQL statements only apply in VB
???
-
Aug 12th, 2005, 12:30 AM
#13
Re: MySql
 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|