Jump to content

Help! Users with groups?


jsschmitt

Recommended Posts

Well your first step is done... having a list of your users in a users table.

 

Your next step is to have a groups table....having a list of all of your groups.

 

The last step (which is really a part of the first step) is to put a column within the users table to signify which group a particular user is in.  You would use the group's primary key for the value.

 

So.  if in your groups table.. the 3rd group was "Da Bears"  and in the users table you must have "Joe" in that group.  You would give Joe's group column a value of 3..    Get it? it's like number matching

Link to comment
Share on other sites

Gah... Still lost..

 

Ok... Here is what I have..

 

Families:

ID    Name

1      Schmitt

 

Users:

id username first_name last_name family password

1  jschmitt          Schmitt          Schmitt          1          xxxxxxxxx

 

And the code I currently have..

 

<?php
session_start(); 
$sesuser = $_POST['username'];
$sespass = $_POST['password'];

include 'php/includes/dbconnect.php';

$query = "SELECT `username` , `family` FROM `users` WHERE `username` = '".$sesuser."' AND `password` = '".$sespass."' INNER JOIN `group` ON users.family = families.id";
$result = mysql_query($query) or die('Error, query failed');

if(mysql_num_rows($result)){
$_SESSION['username'] = $sesuser;
}

while ($row = mysql_fetch_array($result)) {
$_SESSION['family'] = $row['family'];
} 

include 'php/includes/closedb.php';

zheader('Location: http://anomymage.com/famshare/')
?>

 

Please... tell me what I am doing wrong!

 

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.