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
https://forums.phpfreaks.com/topic/249906-pull-user-info-from-mysql-db-in-session/
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.