Jump to content

glennn.php

Newly Registered
  • Posts

    251
  • Joined

  • Last visited

About glennn.php

  • Birthday 02/10/1961

Contact Methods

  • Website URL
    http://www.glennnall.com

Profile Information

  • Gender
    Male
  • Location
    Atlanta, GA USA

glennn.php's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  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
  8. OK, here's the query i'm working with, first of all: (select a.*, a.user as usr, (select answer from answers where question = 'decision' and user = usr limit 1) as decision, (coalesce((select answer from answers where question = 'rater1' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater2' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater3' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater4' and user = usr limit 1),0)) as coal, (coalesce((select answer from answers where question = 'rater1' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater2' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater3' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater4' and user = usr limit 1),0)) / (((select answer from answers where question = 'rater1' and user = usr and answer != 0 limit 1) is not null) + ((select answer from answers where question = 'rater2' and user = usr and answer != 0 limit 1) is not null) + ((select answer from answers where question = 'rater3' and user = usr and answer != 0 limit 1) is not null) + ((select answer from answers where question = 'rater4' and user = usr and answer != 0 limit 1) is not null)) as total, (select answer from answers where question = 'rater1' and user = usr limit 1) as rater1, (select answer from answers where question = 'rater2' and user = usr limit 1) as rater2, (select answer from answers where question = 'rater3' and user = usr limit 1) as rater3, (select answer from answers where question = 'rater4' and user = usr limit 1) as rater4 from answers a INNER JOIN (SELECT user FROM answers WHERE app_id = '24550e5c73136d5081f76dea807fd35b' and question = 'date_completed') b ON a.user = b.user WHERE a.question = 'status' and answer = '0' group by user order by decision desc limit 1000) UNION (select a.*,a.user as usr,(select answer from answers where question = 'decision' and user = usr limit 1) as decision,(coalesce((select answer from answers where question = 'rater1' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater2' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater3' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater4' and user = usr limit 1),0)) as coal, (coalesce((select answer from answers where question = 'rater1' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater2' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater3' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater4' and user = usr limit 1),0)) / (((select answer from answers where question = 'rater1' and user = usr and answer != 0 limit 1) is not null) + ((select answer from answers where question = 'rater2' and user = usr and answer != 0 limit 1) is not null) + ((select answer from answers where question = 'rater3' and user = usr and answer != 0 limit 1) is not null) + ((select answer from answers where question = 'rater4' and user = usr and answer != 0 limit 1) is not null)) as total, (select answer from answers where question = 'rater1' and user = usr limit 1) as rater1, (select answer from answers where question = 'rater2' and user = usr limit 1) as rater2, (select answer from answers where question = 'rater3' and user = usr limit 1) as rater3, (select answer from answers where question = 'rater4' and user = usr limit 1) as rater4 from answers a INNER JOIN (SELECT user FROM answers WHERE app_id = '24550e5c73136d5081f76dea807fd35b' and question = 'date_completed') b ON a.user = b.user WHERE a.question = 'status' and answer = '1' group by user order by decision desc limit 1000) UNION (select a.*,a.user as usr,(select answer from answers where question = 'decision' and user = usr limit 1) as decision,(coalesce((select answer from answers where question = 'rater1' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater2' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater3' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater4' and user = usr limit 1),0)) as coal, (coalesce((select answer from answers where question = 'rater1' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater2' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater3' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater4' and user = usr limit 1),0)) / (((select answer from answers where question = 'rater1' and user = usr and answer != 0 limit 1) is not null) + ((select answer from answers where question = 'rater2' and user = usr and answer != 0 limit 1) is not null) + ((select answer from answers where question = 'rater3' and user = usr and answer != 0 limit 1) is not null) + ((select answer from answers where question = 'rater4' and user = usr and answer != 0 limit 1) is not null)) as total, (select answer from answers where question = 'rater1' and user = usr limit 1) as rater1, (select answer from answers where question = 'rater2' and user = usr limit 1) as rater2, (select answer from answers where question = 'rater3' and user = usr limit 1) as rater3, (select answer from answers where question = 'rater4' and user = usr limit 1) as rater4 from answers a INNER JOIN (SELECT user FROM answers WHERE app_id = '24550e5c73136d5081f76dea807fd35b' and question = 'date_completed') b ON a.user = b.user WHERE a.question = 'status' and answer = '2' group by user order by decision desc limit 1000) UNION (select a.*,a.user as usr,(select answer from answers where question = 'decision' and user = usr limit 1) as decision,(coalesce((select answer from answers where question = 'rater1' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater2' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater3' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater4' and user = usr limit 1),0)) as coal, (coalesce((select answer from answers where question = 'rater1' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater2' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater3' and user = usr limit 1),0) + coalesce((select answer from answers where question = 'rater4' and user = usr limit 1),0)) / (((select answer from answers where question = 'rater1' and user = usr and answer != 0 limit 1) is not null) + ((select answer from answers where question = 'rater2' and user = usr and answer != 0 limit 1) is not null) + ((select answer from answers where question = 'rater3' and user = usr and answer != 0 limit 1) is not null) + ((select answer from answers where question = 'rater4' and user = usr and answer != 0 limit 1) is not null)) as total, (select answer from answers where question = 'rater1' and user = usr limit 1) as rater1, (select answer from answers where question = 'rater2' and user = usr limit 1) as rater2, (select answer from answers where question = 'rater3' and user = usr limit 1) as rater3, (select answer from answers where question = 'rater4' and user = usr limit 1) as rater4 from answers a INNER JOIN (SELECT user FROM answers WHERE app_id = '24550e5c73136d5081f76dea807fd35b' and question = 'date_completed') b ON a.user = b.user WHERE a.question = 'status' and answer = '3' group by user order by decision desc limit 1000) order by answer asc, decision desc, total desc the table is configured like this: app_id | question | answer | user 24550e5c73136d5081f76dea807fd35b | status | 0 | 654a6518d9fas9dad5sdfa8a61ga651 24550e5c73136d5081f76dea807fd35b | name | Bob Smith | 654a6518d9fas9dad5sdfa8a61ga651 24550e5c73136d5081f76dea807fd35b | email | bob@email.com | 654a6518d9fas9dad5sdfa8a61ga651 24550e5c73136d5081f76dea807fd35b | state | NY | 654a6518d9fas9dad5sdfa8a61ga651 24550e5c73136d5081f76dea807fd35b | country | Uganda | 654a6518d9fas9dad5sdfa8a61ga651 24550e5c73136d5081f76dea807fd35b | etc | etc | 654a6518d9fas9dad5sdfa8a61ga651 24550e5c73136d5081f76dea807fd35b | etc | etc | 654a6518d9fas9dad5sdfa8a61ga651 approximately 30 records for each user TIMES 500. (this is the weirdest database config. i've ever seen - i don't even know if this was smart or not - doesn't seem to be, as there are more than 250 thousand records in this particular table already - but these queries are kicking my ass). so the client has asked if i can now add a sort by country option. I'm hoping someone can help me rewrite this query to where it will sort by the answer to the question which is country AS WELL as keeping the status grouped (0, then 1, then 2...). i can do the rest if someone could kindly help me with this...? pretty please...? I'll be very very grateful if someone could show me what needs to be done to include this ability within this query... thanks so much, folks. if it matters, this is how the query is coded: $statusna = ""; for ($j=0;$j<=3;$j++) { $statusna .= "(select a.*,a.user as usr,(select answer from answers where question = 'decision' and user = usr limit 1) as decision,("; for ($i=1;$i<=$raters;$i++) { $statusna .= "coalesce((select answer from answers where question = 'rater$i' and user = usr limit 1),0)"; if ($i<$raters) $statusna .= " + "; } $statusna .= ") as coal,("; for ($i=1;$i<=$raters;$i++) { $statusna .= "coalesce((select answer from answers where question = 'rater$i' and user = usr limit 1),0)"; if ($i<$raters) $statusna .= " + "; } $statusna .= ") / ("; for ($i=1;$i<=$raters;$i++) { $statusna .= "((select answer from answers where question = 'rater$i' and user = usr and answer != 0 limit 1) is not null)"; if ($i<$raters) $statusna .= " + "; } $statusna .= ") as total, "; for ($i=1;$i<=$raters;$i++) { $statusna .= "(select answer from answers where question = 'rater$i' and user = usr limit 1) as rater$i"; if ($i<$raters) $statusna .= ", "; } $statusna .= " from answers a INNER JOIN (SELECT user FROM answers WHERE app_id = '$_GET[app_id]' and question = 'date_completed') b ON a.user = b.user WHERE a.question = 'status' and answer = '$j' group by user order by decision desc limit 1000)"; // ORIG >> $statusna .= " from answers where app_id = '$_GET[app_id]' and question = 'status' and answer = '$j' group by user order by decision desc limit 1000)"; if ($j<3) $statusna .= " UNION "; } $qry = "$statusna order by answer asc, decision desc, total desc";
  9. yes, that works as well. little easier splitting it with php after i get the results, i've discovered, but this worked out fine. thanks much
  10. no, cause even these image names are going to be different. i'm ok keeping the tags, i just want to use the </a> as a delimiter and store everything up to and including that in one var and everything after that in another var. sorry i wasn't as clear the first time. im realizing that this is probably a php question, perhaps using substr()..? my apologies for this being in mysql...
  11. ok, this is clearly 1st grade code for some, but i'm not there yet - I'm querying posts in WordPress, and the post_content will always have an image in the beginning of the post followed by the content. i don't want to get the image, just the content that's after the image, which is wrapped in anchor tags, of course. <a href="http://path/to/image.jpg"><img src="http://path/to/image.jpg" /></a> <p>Post content yadda, yadda, hoowie</p> obviously a character count won't work, so i need to get anything that follows the first "</a>", say...? is this the best way, or is there an easier way? thanks for anyone's help. GN
  12. nope - i'd even tried that earlier... this is the upateWidgetData function that's called - it's getting this far: $("#console").html('<div class="success">Saved</div>').hide().fadeIn(1000); but it's not toggling the .dragbox-content div... function updateWidgetData(){ var items=[]; $('.column').each(function(){ var columnId=$(this).attr('id'); $('.dragbox', this).each(function(i){ var collapsed=0; if($(this).find('.dragbox-content').css('display')=="none") collapsed=1; var item={ id: $(this).attr('id'), collapsed: collapsed, order : i, column: columnId }; items.push(item); }); }); var sortorder={ items: items }; //Pass sortorder variable to server using ajax to save state $.post('updatePanels.php', 'data='+$.toJSON(sortorder), function(response){ if(response=="success") $("#console").html('<div class="success">Saved</div>').hide().fadeIn(1000); setTimeout(function(){ $('#console').fadeOut(1000); }, 2000); }); }
  13. thanks, not quite working, tho... i'm trying to attach it to 'h2 span.handle' : <h2> <span class="handle"></span></h2> here: http://cssphpmysql.com/dev/mylifeline/
  14. i'm not a jquery developer - I'm hoping someone would be kind enough to help me to attach this click event to a span within the h2 instead of the entire h2 heading: $(function(){ $('.dragbox') .each(function(){ $(this).hover(function(){ $(this).find('h2').addClass('collapse'); }, function(){ $(this).find('h2').removeClass('collapse'); }) .find('h2').hover(function(){ $(this).find('.configure').css('visibility', 'visible'); }, function(){ $(this).find('.configure').css('visibility', 'hidden'); }) .click(function(){ $(this).siblings('.dragbox-content').toggle(); updateWidgetData(); }) .end() .find('.configure').css('visibility', 'hidden'); }); $('.column').sortable({ connectWith: '.column', handle: 'h2', cursor: 'move', placeholder: 'placeholder', forcePlaceholderSize: true, opacity: 0.4, start: function(event, ui){ //Firefox, Safari/Chrome fire click event after drag is complete, fix for that /* if($.browser.mozilla || $.browser.safari) $(ui.item).find('.dragbox-content').toggle(); */ }, stop: function(event, ui){ ui.item.css({'top':'0','left':'0'}); //Opera fix // if(!$.browser.mozilla && !$.browser.safari) updateWidgetData(); } }) .disableSelection(); }); <div class="dragbox" id="item12"> <h2><span id="title-12" class="editText">right 2</span><span class="handle" style="float:right; width:49%; height:20px;"></span></h2> <div class="dragbox-content" > <span id="text-12" class="editText">right</span> </div> </div> thanks very much for anyone's help. GN
×
×
  • 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.