Jump to content

Stickie

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by Stickie

  1. Thank you for the reply. I've tried your code, works like a charm. So basically, It fetches the attributes I specify but only if they are in the combinations table and joins the specified tables to get the client_name etc The where is like an extra filter for the table Zendingen, so if I'd add where Active=1 to E.G. clients table it would ignore all clients with Active=0? pls correct me if I'm wrong, just trying to understand the code here.
  2. try <?php $ban3 = "SELECT date FROM banned WHERE id = '".mysql_real_escape_string($_SESSION['user_id'])."'"; $ban2 = mysql_query($ban3) or die(mysql_error()); while ($ban1 = mysql_fetch_array($ban2)) { $pop = $ban1['date']; echo $pop; } ?>
  3. PROBLEM solved, using this code: $test = mysql_query("SELECT Naam, Bestemming, Aantal_Duiven, Name FROM Shipments, Zendingen, Klanten, Manden, Bestemmeling WHERE Zendingen.Actief=1 AND Shipments.Zending_ID=Zendingen.ID AND Shipments.Klant_ID=Klanten.ID AND Shipments.Bestemmeling_ID=Bestemmeling.ID AND Shipments.Mand_ID=Manden.ID") or die(mysql_error()); $num_rows = mysql_num_rows($test); $i = 0; while ($i < $num_rows) { $test2 = mysql_fetch_assoc($test); echo "<table><tr>"; echo "<td>Bestemming</td>"; echo "<td>Naam</td>"; echo "<td>Aantal Duiven</td>"; echo "<td>Naam</td>"; echo "</tr>"; echo "<tr>"; echo "<td>" .$test2["Bestemming"]. "</td>"; echo "<td>" .$test2["Naam"]. "</td>"; echo "<td>" .$test2["Aantal_Duiven"]. "</td>"; echo "<td>" .$test2["Name"]. "</td>"; echo "</tr></table>"; $i++; }
  4. Okay I've tried this and came up with: $test = mysql_query("SELECT * FROM Shipments AS s JOIN Zendingen AS z ON z.ID = s.Zending_ID JOIN Klanten AS k ON k.ID = s.Klant_ID JOIN Manden AS m ON m.ID = s.Mand_ID JOIN Bestemmeling AS b ON b.ID = s.Bestemmeling_ID WHERE Zending_ID = 9") or die(mysql_error()); echo $test; while($test2 = mysql_fetch_assoc($test)) { echo "<br />"; echo $test2["ID"]; echo "<br />"; echo $test2["Bestemming"]; echo "<br />"; echo $test2["Naam"]; echo "<br />"; echo $test2["Aantal_duiven"]; echo "<br />"; echo $test2["Name"]; echo "<br />"; } EDIT: Found my error in displaying the values, but now I'm stuck in what seems an endless loop. What am I missing?
  5. Thank you for posting! I have read your post and it is kinda what I want exept some details which I will try to explain using drawings Combinations table: ID|Zending_ID|Client_ID|Basket_ID|Destination_ID ---------------------------------------------------------------- 1 | 9 | 47 | 13 | 7 now I want to display these values, which I already figured out. but instead of displaying 9 and 47 and 13 and 7 I need it to go fetch them in different tables. Table Clients: ID |Client_Name|Adress |other info -------------------------------------------------- 47| Jeff |5th street| PAYS CASH So it should lookup the ID 47 from combinations table and switch it with Jeff, I hope this cears my problem a bit.
  6. 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: 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
×
×
  • 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.