Jump to content

[SOLVED] Parse error: syntax error help


djsl

Recommended Posts

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

Link to comment
Share on other sites

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));

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.