Hi,
My name is stefan and I've been trying to develop a php/mysql based CRM for private use.
I've stumbled upon a problem a few days ago and I just can't figure it out, so if you could help me, I'd really appreciate it.
The problem is the following:
I have 1 database which contains 5 tables.
Each table has info in it but the primary key always is 'ID'
4 Tables are named; Zendingen | Klanten | Manden | Bestemmeling
The last table, named 'Combination' has the unique ID of each of those 4 in it. The example will be given below.
What I want to do now is create a page that shows all stored rows in 'Combination'-table, but gets the proper client_name or product_info out of the corresponding table.
I have searched for it myself but I have no clue where to begin and how to define my searches so they all stranded.
This is the piece of code.
$Shipm1 = mysql_query("SELECT * FROM Shipments where Zending_ID = 9") or die(mysql_error());
while($row = mysql_fetch_assoc($Shipm1)) {
echo "<br />";
echo $row["ID"];
echo "<br />";
echo $row["Zending_ID"];
echo "<br />";
echo $row["Klant_ID"];
echo "<br />";
echo $row["Mand_ID"];
echo "<br />";
echo $row["Bestemmeling_ID"];
echo "<br />";
}
This code returns:
3 ---- the ID of the 'combination' table and thus primary key
9 ---- Zending_ID
47 --- Klant_ID
17 --- Mand_ID
2 ---- Bestemmeling_ID4 This is another row from the combinations table,
9 notice that it only returns the Zending_ID = 9.
49
21
4
Now this gives me the info I want, but it doesn't displays them how I need it to.
I want it to search up each ID in the proper table and return me the product name, client name etc...
Anyone who can help or point me in the right direction?
Kind regards
Stefan