473,385 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem using md5 to insert encrypted password into table

27
hi!

Am having a problem inserting password after encrypting into a column of a table. am using MySQL.

$[PHP]loginid = $_POST['loginid'];
$password = $_POST['password'];
$encrypt_password = md5($password);

if ($_POST['submit']) {

mysql_select_db("CSU", $con);
$sql="INSERT INTO login2 (loginid, password, privilege) VALUES ('$_POST[loginid]', $encrypt_password, '$_POST[privilege]')";
if (!mysql_query($sql,$con)) {die('Error: ' . mysql_error()); }

mysql_close($con)

;}[/PHP]

table columns are loginid, password, privilege
column for insert into is password, Not Null, VarChar(40).
Getting the error Unknown column 'bc7hjsfsd8sse3sder3...' in field list.
Aug 15 '07 #1
2 3040
gregerly
192 Expert 100+
Your SQL looks alright for the most part, but because MD5 produces a string of numbers and letters, you might need to put quotes around it. That could be your problem.

Hopefully that works.

Greg
Aug 15 '07 #2
prosad
27
Your SQL looks alright for the most part, but because MD5 produces a string of numbers and letters, you might need to put quotes around it. That could be your problem.

Hopefully that works.

Greg
works fine. added quotes.
thus used
Expand|Select|Wrap|Line Numbers
  1. '$encrypted_password'  
instead.
thnks.
Aug 15 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: c duden | last post by:
I am attempting to encrypt some text and be able to decrypt it at a later time. I have two methods to do this: public static Byte EncryptText(string textToEncrypt, string encryptionHash) {...
0
by: Senthil Kannan | last post by:
Hi all, Currently i have a FORM_BASED Authentication of tomcat5.0 to store and retrieve passwords in my homepage.Now when i try to Store my password in a encrypted form i am having some problems,i...
6
by: Ian Davies | last post by:
Hello I would like to query the user table of the mysql database from my VB application to check that a user's password entered in a text field on a form corresponds to that users password in the...
5
by: John | last post by:
Hi I am trying to set a new password using the following code; Dim u As MembershipUser = Membership.GetUser(UserName) Dim OldPassword As String OldPassword = u.GetPassword If...
0
by: Michael Burgess | last post by:
Hi there, I have a problem that's beginning to do my head in and hope someone can help!!! I've got a SQL Server 2005 database which is partly encrypted (certain columns per table are...
1
George Lft
by: George Lft | last post by:
ok, first of all, i built my register page using dreamweaver tool which the codes haven been out of control. Now i'm thinking that turning over everything - by using this another set of codes. And...
2
by: BobLewiston | last post by:
Some of you may have seen my earlier thread “PasswordHash NULL problem”. I’ve started a new thread because investigation has shown that the problem is actually quite different than I previously...
1
by: KalleMOD | last post by:
Hi there! I'm quite new to linux and recently bought my own server. I have installed vsftpd with SSL(FTPES) and it worked fine with local users. Now I want to allow virtual users to login as...
5
topher23
by: topher23 | last post by:
I've seen a lot of questions about how to make secure database passwords. I'm going to go over a method of encrypting a password using the MD5 encryption algorithm for maximum security. First,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.