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
https://forums.phpfreaks.com/topic/63213-held-needed-urgent/
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
https://forums.phpfreaks.com/topic/63213-held-needed-urgent/#findComment-315109
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
https://forums.phpfreaks.com/topic/63213-held-needed-urgent/#findComment-315248
Share on other sites

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.