Are you willing to elaborate or maybe give a good url? I'm eager to learn more. PM if it's OT.

[/quote]
Explanation:
http://en.wikipedia.org/wiki/Many-to-many_(data_model)
Pretty good tutorial:
http://www.tonymarston.net/php-mysql/many-to-many.html[/quote]
I thought about what you said and this is what i came up with.I enumed group categories and let the simple task of joining a group be copying the name of a user to the members field of the group table.
This is how i would build my group.Once i have tested the code extensively i will post it,although the enum code that creates dropdown menu on the fly actually works.
Best viewed under -gedit.
<?
First of all you need to register new members and this is how you do it.
/****************************************************************************************/
__________________register.html__________________
post the information below to your register.php(obviously from the form below!)
Names
Email
Password
Confirm password
Register securely
________________________________________________
____________________users.sql___________________
id | names | email | password
Table name::users
________________________________________________
Once the registration is done and the user is registered,redirect the user to groups.php.Contents of groups.php are discussed below.
NB-1:Remeber to store your passwords in md5 format to keep them safe.
/****************************************************************************************/
Secondly you will need groups.sql to store all information about your groups and here are all the necessary fields in groups.sql.
/***********************************************************************************************************/
id | groupname |group descrptn | members | category | registerdate | owner | topictitle | topiccontent | topic replies
Table name::group
NB-2:categories here,are ENUM options and here are the values;{Php,Moto,Python,C,Haskell,Mysql}.
/**********************************************************************************************************************/
As i said,once a user is logged in successfully,he/she will be redirected to groups.php.I beg to explain the reason why that is so.
/**********************************************************************************************************************/
Here is groups.php.
____________________________________________________________________________________________________
Groups | Create Group | Groups I Am A Member Of | LOGOUT
{The Links above should be arranged as tabs for a neat layout}
____________________________________________________________________________________________________
Allow me to elaborate further on this page,there is nothing unorthodox i must point out as of now,come along.For bravity all time sakes,i will start from left where you can find Groups |....| and i will proceed due right to the point where you see ....|LOGOUT.All files in between Groups and LOGOUT are all .php in generic terms.
It is now time to expain each and every file that falls under groups.php as you can visually gather from above.
Groups |
Link id : group.php
group.php ----This link will query users and group(table users to authenticate the user) and group to get and display the
following information.
group name |group descrptn |group category | total number of members | Action
/******************************************************************************/
I would like to explain a point and to do that, you need see the diplay of
group.php.Since groups.sql has six enum options,there will only be six
categories to choose from.Allow me to display 'false' info that is meant to show how
group.php would display these data from the table 'group'.
/******************************************************************************/
group name |group descrptn |group category | total number of members | Action
xxx evil moto 64 Join
NB-3:Moto is the default option under our ENUM options from the group table
_______________________________________________________________________________
Question::----What exactly happens when a user presses the join button?.
Answer::::----This is what happens.First of all,if a user has arrived at this point,we can safely say that we have
established that the user credentials are authentic.What the group.php does is,it writes the names of the
current user to table 'group' under the members field.How does group.php do that?,simple,it pulls the
names
of the user identified by some session id(SID)straight from the users table.
Anti-Duplicate Measures::::----You could use javascript or ajax to disable the Join button above if you have it on good
authority from the SID incharge that indeed the current user is already a member of the group.
______________________________________________________________________________________________________________________
______________________________________________________________________________________________________________________
| Create Group |
Link id : create_group.php
create_group.php----This link will open a web form.This form will ask you to fill in details about the group you want to
create i.e,
_______________________________________________________________________________________________________________________
group name
category
group description
owner
REGISTER GROUP SECURELY
NB-4:You may ask,why do you bother yourself asking logged in members to provide their names while you could have just
pulled their names straight from the database?.I could say my answer is deceptively simple.I fancy that if i allow
my members to excercise creativity by deciding what should be displayed as their owner names, you are likely to get
very creative members.An owner name that says 'noneofyourbiz' is not illegal but sad because at one time or the
other, you might need to display the owner of the group and you dont want some jibe showing up do you?.
_______________________________________________________________________________________________________________________
_______________________________________________________________________________________________________________________
| Groups I Am A Member Of |
Link id : groups_i_have_joined.php
groups_i_have_joined.php----This link will query group table and users table.The users table query is first and its
function is,it ensures that the user is logged in the first place.The second query is made
to the group table to let us know which groups the user in question is a member of and here
is a sample sql code to achieve that:
/***********************************************************************************************/
$result = "select names from group where names=$names";
You will need to tap the $result as an associative array to display the groups i have joined well
/***********************************************************************************************/
________________________________________________________________________________________________________________
NB-5:You can make always pass the $names variable as a global variable to make use of it in instances like this.
________________________________________________________________________________________________________________
/***************************************************************************************/</SELECT></TD></TR>
You could also attach UNJOIN link at the end of every 'group_i have_joined' like this:
Groups I Have Joined Action Category
1.I party harder than Elliot Spitzer UNJOIN Php
2.Hollywood script writers UNJOIN Python
3.Nairobi Night Runners UNJOIN C
Here is what i reckon will go to the UNJOIN link
/**************************************************************************************************/
$result2 = "delete names from group where category = $category and groupname = $groupname";
/**************************************************************************************************/
| Logout |
<>Unset session variables.
I dont know how an advanced version of a group script would look like but i am guessing people using any advanced grouping software use ACL classes extensively to define who has the rights to do what for instance in optioning whether a group is open for membership or members are invited during the making of a group.I am sharing this pseudocode to allow anyone with any good idea on how better i could improve my group script.I thought listing ENUM options could be a problem for some so i wrote this code for anybody interested in testing this simple system.
/**********************************************************************************************************************/
<?
//db.php
$dbhost = 'localhost';
$dbusername = 'phpserver';
$dbuserpassword = 'phpserver';
$default_dbname = 'mysql';
//define all the important parameters above
$MYSQL_ERRNO = '';
$MYSQL_ERROR = '';
function db_connect()
{
global $dbhost,$dbusername,$dbuserpassword,$default_dbname;
global $MYSQL_ERRNO,$MYSQL_ERROR;
//global parameters now 'initialized'
$link_id = mysql_connect($dbhost,$dbusername,$dbuserpassword);
if(!$link_id) {
$MYSQL_ERRNO = 0;
$MYSQL_ERROR = "Connection failed to the host $dbhost";
return 0;
}
else if(empty($dbname) && !mysql_select_db($default_dbname)) {
$MYSQL_ERRNO = mysql_errno();
$MYSQL_ERROR = mysql_error();
return 0;
}
else return $link_id;
}
//handle error function up next
function sql_error() {
global $MYSQL_ERRNO,$MYSQL_ERROR;
if(empty($MYSQL_ERROR)) {
$MYSQL_ERRNO = mysql_errno();
$MYSQL_ERROR = mysql_error();
}
return "$MYSQL_ERRNO: $MYSQL_ERROR";
}
//a section of code i added to handle enum options
function enum_options($field, $link_id) {
$query = "SHOW COLUMNS FROM users LIKE '$field'";
$result = mysql_query($query,$link_id);
$query_data = mysql_fetch_array($result);
if(eregi("('.*')",$query_data["Type"], $match)) {
$enum_str = ereg_replace("'", "", $match[1]);
$enum_options = explode(',', $enum_str);
return $enum_options;
} else return 0;
}
/*************************************************************************************/
To test whether this code works use this code::
//enum_test.php
include "db.php";
$link_id = db_connect();
mysql_select_db("group");
//make a database named group and dump groups.sql and users.sql
$array = enum_options('category',$link_id);
foreach($array as $var) echo $var,"<P>";
/************************************************************************************/
?>
For an absolute beginner,this is how i constructed my drop down menu on the fly.
<?
//create_group.php and anywhere else where a drop down menu or categories is needed
include "db.php";
$link_id = db_connect();
mysql_select_db("group");
$category_array = enum_options('category', $link_id);
mysql_close($link_id);
//note that now the category array holds all categories a user can possibly choose from
<TR>
<TH WIDTH = "32%" NOWRAP>Categories</TH>
<TD WIDTH = "68%"><SELECT NAME="categories" SIZE="1">
for($i=0; $i < count($category_array); $i++) {
if(!isset($category) && $i == 0) {
echo "<OPTION SELECTED VALUE=\"". $category_array[$i] . "\">" . $category_array[$i] . "</OPTION>\n";
}
else if($category == $category_array[$i]) {
echo "<OPTION SELECTED VALUE=\"". $category_array
. "\">" . $category_array[$i] . "</OPTION>\n";
}
else {
echo "<OPTION VALUE=\"". $category_array[$i] . "\">" . $category_array[$i] . "</OPTION>\n";
}
}
</SELECT></TD></TR>
?>
___________________________________________________________________________________
It is no longer a miracle for man to walk on water,he must now watch and conserve it
-Anonymous