Jump to content

Pull user info from mysql DB in session


ziggynerja

Recommended Posts

Hello all,

 

I have a membership website which is using sessions... and ive been asked to add some promotion points system. So that each user is able to see how many promotion points they have...

 

Now, I'm a beginner in mysql and php, but feel I'm learning fairly quickly. What I need help with, is to be able to display the amount of promotion points for the logged in user.

 

I created a new field in my "essenti1_Users" table for the promotion code.

 

database is called "essenti1_membership"

table is "essenti1_Users"

feild is "promo"

 

 

I think im going to have to manually add the points to each user manually through phpMyAdmin Navicat unfortunatly. Unless anyone has any other ideas just for adding the points to each user account?

ziggynerja is online now Add to ziggynerja's Reputation Report Post  Edit/Delete Message

Link to comment
Share on other sites

Hi Mate

 

I'm no php superstar liek some of the guys here but you could try somethnig like this:

 

//this assumes you've already connected to your DB

$sql = "SELECT promo FROM  TABLENAME  WHERE  id = USERID";

$result = mysql_query($sql);

$promo = mysql_fetch_assoc($result);

echo $promo[promo];

//Or if you wanted to assign it to the sessino then:

$_SESSION['promo']= $promo[promo]; 

//then you could do echo 

echo $_SESSION['promo'];

 

Incidentally just writing this off the top of my head so i can't be 100% it works without testing it but something along those lines.

 

Hello all,

 

I have a membership website which is using sessions... and ive been asked to add some promotion points system. So that each user is able to see how many promotion points they have...

 

Now, I'm a beginner in mysql and php, but feel I'm learning fairly quickly. What I need help with, is to be able to display the amount of promotion points for the logged in user.

 

I created a new field in my "essenti1_Users" table for the promotion code.

 

database is called "essenti1_membership"

table is "essenti1_Users"

feild is "promo"

 

 

I think im going to have to manually add the points to each user manually through phpMyAdmin Navicat unfortunatly. Unless anyone has any other ideas just for adding the points to each user account?

ziggynerja is online now Add to ziggynerja's Reputation Report Post  Edit/Delete Message

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.