djsl Posted September 16, 2009 Share Posted September 16, 2009 I have this code right now $sql_data_array = array('members_firstname' => kry_db_input($firstname), 'members_lastname' => kry_db_input($lastname), 'username' => kry_db_input($username), 'members_password' => kry_encrypt_password($password)); I would like to insert the password in a table depending on the $role var they picked in the form I have multiple users in a group using the same username but want them to have dfferent password. something like this 'members_$role' => kry_encrypt_password($password)); or '$role' => kry_encrypt_password($password)); of course my examples dont work as they are thanks Quote Link to comment https://forums.phpfreaks.com/topic/174492-solved-parse-error-syntax-error-help/ Share on other sites More sharing options...
gevans Posted September 16, 2009 Share Posted September 16, 2009 So far this makes no sense to me? Are you using a framework, 3rd party script? Is it your script? What is it doing, what's it meant to be doing? Quote Link to comment https://forums.phpfreaks.com/topic/174492-solved-parse-error-syntax-error-help/#findComment-919643 Share on other sites More sharing options...
djsl Posted September 16, 2009 Author Share Posted September 16, 2009 sorry for being so vague and no this is not my script it is a create account script I am trying to have 12 people per group the first person would create the account (this script) there is a dropdown in the form where he selects his role in the group then the others simply using the same username fill out a simple form later with their password I have set up fields in the database for all the different passwords for all the different people in the group and $role would be the location defining the individual password locations. the variable is $role and I want it to substitute the current location of the password 'members_password' that is currently in the script when used with a single person login this is the original line in the script: 'members_password' => kry_encrypt_password($password)); I tried different ways of doing it but I have not gotten it to work. I am new at this and learning, and I am sure it is very simple. I hope this makes sense. here is one way that I tried '$role' => kry_encrypt_password($password)); Quote Link to comment https://forums.phpfreaks.com/topic/174492-solved-parse-error-syntax-error-help/#findComment-919662 Share on other sites More sharing options...
djsl Posted September 16, 2009 Author Share Posted September 16, 2009 I probably made this more complicated than it is All I want to do is send the $password (encrypted) to the database location $role Quote Link to comment https://forums.phpfreaks.com/topic/174492-solved-parse-error-syntax-error-help/#findComment-919776 Share on other sites More sharing options...
gevans Posted September 16, 2009 Share Posted September 16, 2009 kry_encrypt_password() does that function exist? can we see it? what happens currently (what is the error)? Quote Link to comment https://forums.phpfreaks.com/topic/174492-solved-parse-error-syntax-error-help/#findComment-919777 Share on other sites More sharing options...
socratesone Posted September 16, 2009 Share Posted September 16, 2009 Is this code supposed to use the $role variable as the key? '$role' => kry_encrypt_password($password)); If so, you're not going to get what you want. Instead, you're going to get the string litteral '$role' as the key, rather than the variable. If you want to use variables in the key, you must use double quotes rather than single quotes, ie: "members_$role" => kry_encrypt_password($password)); However, I think that you need to re-evaluate what you are doing here. You should probably NOT have multiple users with the same user name. You should probably have a group table that associates user ids with that group. Then, each user will log in with their own user name and their group identity will be in the database. Quote Link to comment https://forums.phpfreaks.com/topic/174492-solved-parse-error-syntax-error-help/#findComment-919784 Share on other sites More sharing options...
djsl Posted September 16, 2009 Author Share Posted September 16, 2009 thanks socratesone the double quotes worked thanks for the advice on the users, I will rethink the way to do it. Quote Link to comment https://forums.phpfreaks.com/topic/174492-solved-parse-error-syntax-error-help/#findComment-919794 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.