Hi friends,
I have a major doubt: Could you please help me with this...

I have a create company form, create project form..
In the create company form, it creates the company name and a company code for it..and in the project form, i have one field as option value, which takes the company name from the company form and populates in and also a project code..In the same create project form, i have 4 other fields as:
user A- name:
User A - pass:

User B - name:
User B- pass :

Which is basically v cannot create a project b4 creating a company.On company can have more than one projects

eg:
C1 - P1 - 2 username, 2 passwords
C2 - P1 - 2 username, 2 passwords
- P2
C3 - P1
- P2
- P3
================================================
I want the company code to be like - 1001 and auto increment:
so what i did was, when creating the company, i create a table for each company with the company name as table name:while doing this, i also insert the values to a standard table "create_company"..in which i have the auto-increment code and company name:

Then when creating project, that particular project details will be entered into that particular company tables...
It all works good for me...
================================================
The project code is 01, 02..
Can v have auto - increment of codes like this..(01,02)..
When i tried and checked my database tables...it takes the value as 1, 2, 3, ....But i need it to be 01,02..

Can it be done ?


Another question is....
In the project form details : we have 4 fields
which is the username and password...which helps user for login access.
I have a user Login page : This has to check from all the company projects that has been created...How do i do a check in it...?

Previously when i have one common table for projects:it works:

the code that i used for checking standard table is below:
The standard table is "company_creator"

$result = mysql_query("SELECT * FROM company_creator WHERE c_name='$name' AND c_pass = '$pass'");
$result1 = mysql_query("SELECT * FROM company_creator WHERE m_name='$name' AND m_pass = '$pass'");
if(mysql_fetch_array($result))
{
$_SESSION['login'] = $name;
header("Location: UserA.php");
return;
}
else if (mysql_fetch_array($result1))
{
$_SESSION['login'] = $name;
header ("Location: UserB.php");
return;
}
else
$_SESSION['error'] = "Login failed";
}
header("Location: user_login.php");

But now i have many tables generated as the admin create many companies.....
and inside of each company table, it has 2 username and 2 passwords..
How do i check it ?

I tried something like :but didnt work...

$table = mysql_query("select company_name from create_company");
$sql = mysql_fetch_array("$table");
$output = mysql_query("select c_name.$sql,c_pass.$sql from $sql Where c_name ='$name' AND c_pass = '$pass'");

* - where create company is table that i have the auto- increment id and the company name

Can any1 help me with this..?
Thanks in Advance..
:)

Does any1 know how to make it work...?
Any Help...

Thanks.

How to check the username and password from all the tables that are created..

Can any1 help in this..
Please..

Thanks,
tryphy..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.