Jump to content


New Members (no posts)
  • Content Count

  • Joined

  • Last visited

Everything posted by glennn.php

  1. Sensei - how in the world are you getting a value for $level...?
  2. a really good dude put this Query/output together for me, where i've now tried to add a new field, "info" to the 'persons' table, and am unable to query it correctly within the array: person_id| fname | lname | [[ info ]] 1 Lyndon B Johnson some info here... 2 Bobby Baker (null) 3 Malcolm Wallace (null) 4 George de Mohr (null) 5 Lee Harvey Oswald (null) 6 Howard Hunt (null) 7 Frank Sturgis (null) and the query and output (i've wrapped my attempts in [[ ]]): SELECT p_id, a_id, CONCAT(p1.fname,' ',p1.lname) as name1, p_to_a as association, CONCAT(p2.fname,' ',p2.lname) as name2, [[ p3.info ]] FROM assocs a INNER JOIN persons p1 ON p1.person_id = a.p_id INNER JOIN persons p2 ON p2.person_id = a.a_id INNER JOIN persons p3 ON p3.info = a.a_id I'm not good with arrays at all, but i've given this a few different tries, and end up echoing the "info" everywhere in the output but where I want it to be, which is along with the name of the particular person_id of its row, of course: $data = []; $res = $db->query($sql); while (list($pid, $aid, $n1, $ass, $n2, [[ $nf ]]) = $res->fetch_row()) { if (!isset($data[$pid])) { $data[$pid] = [ 'name' => $n1, 'assocs' => [] ]; } $data[$pid]['assocs'][$aid] = ['name' => $n2, [[ 'info' => $nf, ]] 'rel' => $ass]; } $processed=[]; listAssociates(1, $data, $processed, 0); function listAssociates($pid, &$data, &$processed, $level) { if (!isset($data[$pid])) { return; } if (in_array($pid, $processed)) return; // prevent circular references $processed[] = $pid; if ($level==0) { echo "<div class=''>{$data[$pid]['name']}</b> » </div>"; } // $indent = str_repeat(' ', $level*10); $indent = ($level*25); $indent = ($indent+25)."px"; foreach ($data[$pid]['assocs'] as $aid=>$adata) { echo "<div style='margin-left:$indent'>{$adata['rel']} <b>{$adata['name']}</b></div> [[ {$adata['info']} ]] \n"; listAssociates($aid, $data, $processed, $level+1); } } could some kind person help me include this field in the query and the output, please?
  3. incidentally, this is the raw html that i'm attempting to convert to database driven data: http://stemmonsfreeway.com/ - if you take a look, scroll down past the "Intro" and open "Military Industrial..." You'll see what I'm talking about, how much data there will be - this is only a start of the project. It's going to continue growing...
  4. Sensei, you Rock (that's American for "thanks, Mate"). This is going to be an enormous database and hopefully a terrific addition to the JFK Assassination community. I will add your name as an appreciated contributor when it's public, with your permission. Thanks so much, Mate.
  5. Dude, I believe you've nailed it. I didn't get a notif. for this, so I'm just now seeing it, but it looks more than perfect. I'm trying it now, and will come back and thank you...
  6. firstly, I am not a db programmer. I ply my trade in WordPress stuff, but not in-depth db structuring from scratch. please keep that in mind as I do my best to ask this question? I have made some headway creating two tables that I think will almost, kinda do what I want, which is: Phillips pid1Barnes pid2Moore pid3de Mohrenschildt pid4Oswald pid5 Hunt pid6Sturgis pid7Moore pid3 I've created a (really large) outline in html that simply shows, in effect: Phillips (knows) » Barnes (supervised) » Moore (supervised) » de Mohrenschildt (knows) » Oswald ... AS WELL AS, Phillips (knows) » Hunt (knows) » Sturgis (followed, who also knows) » Moore (same, pid3) ... I put Sturgis followed by Moore specifically to show that these relationships are in no way numerically sequential from the ASSOCS table. There will be 4 or 500 Persons, (and 40 or 50 Organizations, once I get this solved). You can see an example of it here (there's lots of data going on in this outline): http://stemmonsfreeway.com/military-industrial-intelligence-anti-castro-syndicated So, I've come up with these tables: [persons] id, name ----------------- 1 Phillips 2 Barnes 3 Moore 4 de Mohrenschildt 5 Oswald 6 Hunt 7 Sturgis [assocs] p_id, a_id ---------------- 1 2 2 3 3 4 4 5 1 6 6 7 7 3 And I have this query: SELECT a1.p_id, p1.name AS 'Name', a2.p_id, p2.name AS 'FName1', a3.p_id, p3.name AS 'FName2' FROM assocs a1 JOIN assocs a2 ON a1.p_id = a2.a_id JOIN assocs a3 ON a2.p_id = a3.a_id JOIN persons p1 ON a1.p_id = p1.id JOIN persons p2 ON a2.p_id = p2.id JOIN persons p3 ON a3.p_id = p3.id WHERE p1.id = 1 AND p2.id = 2 AND p3.id = 3;which returns: 1 Phillips 2 Barnes 3 Moore *** The problem I have is where a trail ends, Phillips to Oswald, and starts again, Phillips to Hunt to Moore, for instance. *** What I need is a way to define an end to a string of associations and a start of the next one, perhaps with another field or two in the ASSOCS table, or another table... (I'd also love to be able to denote one of a few types of relationships, i.e. "friend" "foe" "supervised" "worked for" ...) *** I'm hoping some kind soul can help me with a query that can do this, and some advice on how to handle it in the tables I've started with...?
  7. this is tricky to explain: I have a raw php script, written by someone else, that sends an email to a list extracted from a CSV file. It requires that certain values in the file be manually edited each time it's used, such as the following: $mail->setFrom('email@email.com', 'From Name'); // <==== change email address, From Name $subject = "Subject Line"; // <==== Adjust this subject $html = ' html here '; // <==== include email html MagicParser_parse("test.csv","myRecordHandler","csv|44|1|34"); // <==== change 'test.csv' file name the function is called by simply calling this email.php file in the browser. I'd like to build a form that would a) edit these values/strings on the fly and then b) call the file in the browser. The thing is, it's been a while since I've messed with PHP forms to any extent, and I can't remember how to get started on something like this. And I'm not familiar at all with fopen and fwrite to edit strings like this without messing up the existing code (there's a lot of other code in the file that needs to be left alone, obviously). I'm hoping someone can help me with a starting point - an idea on how to get this thing going - whether to build the form right in the same file or to build one in another file that posts these values to this existing file... hopefully someone can understand what I'm asking, and thank you much for your help. regards, glenn
  • 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.