5, December 2008

adding new field to user table - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: adding new field to user table
« previous next »
Pages: [1] Print

Author Topic: adding new field to user table  (Read 556 times)
Raped By Google
*
Gender: Male
Posts: 27
206 credits
Members referred : 0

PPC 4 Real Estate


« on: Feb 06, 2007, 07:28:35 AM »

I needed to add a new field to the user table that basically receives an affiliate ID number from a url variable. I've made a series of changes to access_user_class.php and to the register.php page as documented below. It seems to work without problem but I'm sure it can be dressed up but I thought I would pass on what I have done. The new value from the url variable is being inserted the databse at the registration. 

Here are the changes I made.

I added a column to the table users (I happened to name it "upline_num" and it is in the sql statement below) and inserted a variable named "showcookie2" that I retrieve from the url.
The line numbers are approximate as they change when lines are added.

On access_user_class.php
I added

var $user_showcookie2; at line 79

Change line 638 (added $showcookie2 like this:

function register_user($showcookie2,$first_login, $first_password, $confirm_password, $first_name, $first_info, $first_email) {

Change line 659 (added db column name upline_num) like this:
   $sql = sprintf("INSERT INTO %s (id, upline_num, login, pw, real_name, extra_info, email, access_level, active) VALUES (NULL, %s, %s, %s, %s, %s, %s, %d, 'n')",
(note that I also added another %s after values above to match the added parameter "upline_num")

Added line 662
$this->ins_string($showcookie2),

Then in register.php

I collect the showcookie2 value from the cookie  and
changed the line 22 (i.e. I added $_POST['showcookie2'],) like this
$new_member->register_user($_POST['showcookie2'],$_POST['login'], $_POST['password'], $_POST['confirm'], $_POST['name'], $_POST['info'], $_POST['email']); // the register method

hope it helps!


« Last Edit: Feb 06, 2007, 07:41:11 AM by RealEstateAdvertis »
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6487
39754 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Feb 06, 2007, 08:10:51 AM »

I don't suggest to add fields to the user table, use the profile table for additional information.

another way is to use the field extrainfo...


Last blog : Just a better Internet portal provided by Google
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=5951
Tags : adding fields Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: adding new field to user table
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Dec 05, 2008, 11:51:56 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.999
Total Topics: 7.685
Total Members: 4.470
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: srinivasarao

32 Guests, 4 Users online :

9 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.