Jump to content

Held needed urgent!


studgate

Recommended Posts

I have four tables in my database, offices, members,

activities & groups.

What I want to do is if the user has a group/activity/office

in the database, to show it in his profile.

I know it should be an if/else statement but I need some

help display the data.

 

Example: Username is jean, and if jean has entered any groups,

offices,  when jean login into his account,

the group name and the office name will show so jean can see and

update them.

Thanks Guys!

 

Link to comment
Share on other sites

just the query will be helpful. basically check the username

for each table and if the username is jean, show information.

the db structure is simple, users ask for username, address, phone,

CREATE TABLE `users` (
  `id` int(10) NOT NULL auto_increment,
  `firstname` varchar(30) NOT NULL default '',
  `lastname` varchar(30) NOT NULL default '',
  `email` varchar(50) NOT NULL default '',
  `phone` varchar(15) default NULL,
  `country` varchar(30) default NULL,
  `username` varchar(30) NOT NULL default '',
  `password` varchar(30) NOT NULL default '',
  `status` int(1) NOT NULL default '1',
  `registration_timestamp` int(20) NOT NULL default '0',
  `email_verify_code` varchar(12) default NULL,
  UNIQUE KEY `id` (`id`),
  UNIQUE KEY `username` (`username`),
  UNIQUE KEY `email` (`email`)
);';

the other tables are similar. the username field for each table

is filled when the user submit any of the form.

Thanks again guys.

Link to comment
Share on other sites

<?php

$select=mysql_query("SELECT * FROM offices WHERE username='$username' ") or die(mysql_error());

while($sql=mysql_fetch_array($select)) {

echo "Username: $sql[username]"
. "Offices: $sql[offices]";

}

?>

 

just do the same thing for each table and keep giving each variable a unique name. You can also do it with a more complicated query using joins...

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.