Garcia Posted October 20, 2007 Share Posted October 20, 2007 I am developing a Project Management System and I need a logical way on how to assign projects to clients. Here is the table I have: Table: projects Field 1: project_id Field 2: projectname Field 3: projectdesc Field 4: projectclient Each client is assigned their own ID. So how would I be able to create an IF statement to show only the client their own project? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/74035-logical-way/ Share on other sites More sharing options...
Ninjakreborn Posted October 20, 2007 Share Posted October 20, 2007 www.activecollab.com if you want some standing examples, if they still have there trial, you can get some good ideas from there database structure. Quote Link to comment https://forums.phpfreaks.com/topic/74035-logical-way/#findComment-373782 Share on other sites More sharing options...
sKunKbad Posted October 20, 2007 Share Posted October 20, 2007 is the table in a mysql database? You want us to make up a simple query for you? This is the basics of php/MySQL. Quote Link to comment https://forums.phpfreaks.com/topic/74035-logical-way/#findComment-373785 Share on other sites More sharing options...
Garcia Posted October 20, 2007 Author Share Posted October 20, 2007 Its a MYSQL table. No I just want if someone can explain how I can do this logically. Quote Link to comment https://forums.phpfreaks.com/topic/74035-logical-way/#findComment-373786 Share on other sites More sharing options...
sKunKbad Posted October 20, 2007 Share Posted October 20, 2007 create another table with clientName and passWord fields. Have the user log in. Once logged in, use the clientName in a simple query to the projects table, and echo the rows in the result. Quote Link to comment https://forums.phpfreaks.com/topic/74035-logical-way/#findComment-373788 Share on other sites More sharing options...
Garcia Posted October 20, 2007 Author Share Posted October 20, 2007 Ok this is what I did: Under projects table, projectclients will be assigned an email that needs to match the email of the client to display the project. But that is what I am having problems with. Here is the client.php page. <?php session_start(); header("Cache-control: no-cache"); require ('config.php'); $sql ='SELECT email FROM user'; $rs = @mysql_query($sql, $con); $row = mysql_fetch_assoc($rs); $sql2 ='SELECT projectclient FROM project'; $rs2 = @mysql_query($sql, $con); $row2 = mysql_fetch_assoc($rs2); $email = $row['email']; $projectclient = $row['projectclient']; if($_SESSION['email']){ print " Welcome "; print $_SESSION['email']; } else { header ("Location:login.php"); exit(); } if($email == $projectclient) { print " You have a project. "; } else { print "Umm no project"; } ?> It displays umm no project even when I assigned that project to that email... Quote Link to comment https://forums.phpfreaks.com/topic/74035-logical-way/#findComment-373799 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.