Jump to content
Larry Ullman's Book Forums

BHB

Members
  • Posts

    49
  • Joined

  • Last visited

Everything posted by BHB

  1. Thanks! I was leaning that direction. This is just for home server convenience.
  2. Avatar is a carriage horse. So I am behind but up high enough to see across his back. I am a horseman and artist. Have not been programming for long. I will study this. Maybe my problem has been in presenting a correctly formatted array. Array must be two dimensional, correct? Using SPL to get file name and file size. Just my first time using these functions. I have stuck to procedural code to date though i have been reading oop. Knowing it is possible helps a lot!!! Thank you. I will post some code if I get super stuck.
  3. I am writing a little script to read files in a folder (photos) returning an array of file name and file size. Can mysqli handle a prepared statement inserting an array? Would be nice to insert 500 photo names at once rather than typing them all in. Ps.. Not for a public site, just a script i run on a home server to build a site. Tx
  4. Can you have all data in one domain and own say 30 domains that relate then feed each domain different subset of data to build complete different sites? I assume yes. Suggest a book??
  5. Well thank you, I understand. I would like to further understand this books chapter. Maybe then i will better understand your method. Anyone willing to attempt helping me on the books method??
  6. Good gracious! This is way over my head. I am in kindergarten code I guess. I don't see me writing this amount of code to produce pedigrees,.. The depth of these queries is unbelievable! I am just starting with stored procedures. This method is a bit familiar; I think I had come across it before. I am only 18 months self taught in my spare time. Makes the self join loop in Larry's task example look so simple. You have not use recursive functions? You want me to learn this, I think you should make a recursive function!!! In jest,. you must be a genius and it would only take you 10 minutes. What about CSS? Do you have design in your bag of tricks?
  7. Hmmm, hartley-how do you auto fill left and right position for tree? This must be entered by hand or an algorithm? I am not very patient am I?
  8. Ok, reading this. Being my experience level I can not argue approach. Right off I am seeing that this returns position (design). I want to be able to produce CSS div tags. Will I be able to with this method? This is mandatory for me. I wish I had 12 hour days to study and learn everything out there but I only get a couple hours/ day. Another important criteria is to produce XML. You must understand if I want to produce information to 100, 800 domains on many servers i have only one method to do this that makes me feel as a business owner will satisfy producing my product. XML data. I have to this point really only learned Larry Language. I can wrap my brain around other but will take me some time to get it. I ask these questions ahead (divs and XML ) so I know I am climbing the right tree!! Ha ha ha!! If nothing else it will help me learn to think outside my box. I still must learn this chapter in Larry's book as well. It is not ok with me to hit a dead end when I set out to learn something. Correct method or not, these are most worn pages in any of my books. So back to page 19-20? That function I wrote will go up single line of sireid right? Makes me think I must encorporate the damid into single function. Array with just three id should be iterated each to three id each,.. I can call the names after id are found with a stop. Array(horseid, sireid, damid) Reading entire links now Hartley,..
  9. I can see entering 100 horses a day easy, maybe more. So the reorder each time a record is added sounds scary.
  10. hmmm, much to digest. I guess I don't understand why I would separate the tables. would I not take chance of duplicate entries for sire/dam? It takes time for me to absorb, so my initial reaction is just confusion. descendants as a word to me means top down, not bottom up. Here is some data. Not that I have entered enough to get really good charts yet. Most is sire => 1 and dam=> 2. I can add more flushed out pedigrees is that helps. Array ( [horse_id] => 1 [horse_name] => Unknown Stallion [sire_id] => 1 [dam_id] => 2 ) Array ( [horse_id] => 2 [horse_name] => Unknown Mare [sire_id] => 1 [dam_id] => 2 ) Array ( [horse_id] => 3 [horse_name] => CHINN [sire_id] => 1 [dam_id] => 15 ) Array ( [horse_id] => 4 [horse_name] => R-Saluut II [sire_id] => 1 [dam_id] => 1 ) Array ( [horse_id] => 5 [horse_name] => C-Picasso [sire_id] => 3 [dam_id] => 2 ) Array ( [horse_id] => 6 [horse_name] => BROADWAY boogie-woogie [sire_id] => 1 [dam_id] => 15 ) Array ( [horse_id] => 7 [horse_name] => Captain America [sire_id] => 6 [dam_id] => 2 ) Array ( [horse_id] => 8 [horse_name] => R-Flash Gordon [sire_id] => 4 [dam_id] => 2 ) Array ( [horse_id] => 9 [horse_name] => Destiny [sire_id] => 4 [dam_id] => 20 ) Array ( [horse_id] => 10 [horse_name] => Biscotti [sire_id] => 4 [dam_id] => 14 ) Array ( [horse_id] => 11 [horse_name] => Berolina [sire_id] => 5 [dam_id] => 2 ) Array ( [horse_id] => 12 [horse_name] => Byacinthe II [sire_id] => 4 [dam_id] => 2 ) Array ( [horse_id] => 13 [horse_name] => American Girl [sire_id] => 4 [dam_id] => 14 ) Array ( [horse_id] => 14 [horse_name] => Pristine [sire_id] => 3 [dam_id] => 2 ) Array ( [horse_id] => 15 [horse_name] => Frascatti [sire_id] => 1 [dam_id] => 2 ) Array ( [horse_id] => 16 [horse_name] => Zu Zu [sire_id] => 5 [dam_id] => 2 ) Array ( [horse_id] => 17 [horse_name] => La Bella [sire_id] => 1 [dam_id] => 2 ) Array ( [horse_id] => 18 [horse_name] => VicTaurus [sire_id] => 1 [dam_id] => 2 ) Array ( [horse_id] => 19 [horse_name] => Olivia [sire_id] => 1 [dam_id] => 2 ) Array ( [horse_id] => 20 [horse_name] => October Secret [sire_id] => 1 [dam_id] => 2 ) Array ( [horse_id] => 21 [horse_name] => White Shoulders [sire_id] => 1 [dam_id] => 2 ) Array ( [horse_id] => 22 [horse_name] => Daisy [sire_id] => 1 [dam_id] => 2 ) Array ( [horse_id] => 23 [horse_name] => Farlapp [sire_id] => 1 [dam_id] => 2 ) Array ( [horse_id] => 24 [horse_name] => cZur [sire_id] => 3 [dam_id] => 2 ) Array ( [horse_id] => 25 [horse_name] => Belle [sire_id] => 1 [dam_id] => 2 ) Array ( [horse_id] => 26 [horse_name] => Lydia [sire_id] => 1 [dam_id] => 2 ) Array ( [horse_id] => 27 [horse_name] => Limbo [sire_id] => 1 [dam_id] => 2 ) Array ( [horse_id] => 28 [horse_name] => Royal Prospect [sire_id] => 1 [dam_id] => 2 )
  11. While getting file, here is a link of an old page. Pedigree does not link, static text probably in a table. http://cloverlone.com/Broadway.htm
  12. Ok Antonio. I will fire up the computer. Give me a minute.
  13. I don't see the connection on that link. The id in my database is not because of position, it is an autoid in a list of maybe thousands of horses. I can see that position will need a number but example has position being the id. First horse queried based on variable sent to form. Then query should retrieve fatherid as an array(id, name, fatherid, motherid), motherid as an array (id, name, fatherid, motherid), etc. trick is in writing a function to shorten long worded query.... It is long. I got to second grandmother and knew was best to abort and get function to do work. Maybe I want a six generation pedigree link instead of three. That would be insane code. I will keep reading link see if I can't translate the info into what I need.
  14. 1for unknown father and 2 for unknown mother, not 0, 1.
  15. Yeah, a clue. I do have my table as above with the I'd, name, fathered, motherid. ( Going to whack spell check),..When I add a horse there is auto fill of 0- unknown father and 1-unknown mother. This is important for adding a horse who does not have parents already in database. Once horse name, year born, proper search that horse does not already exist,.. Is entered then one can edit update and go through same process for parents. That is more than need know for this venture. My search is pretty cool though. Have not used Ajax yet but,.. Back to pedigree and goals. I am building a massive database that will provide XML data for my many web horse farm clients. I am tired of hand coding pedigrees!!!!! Links to each in pedigree goes to horses detail page with pics, etc. Plan is that all data entered in one place, ..help maintenance that way rather than copying db to multiple servers every time it is updated. Many of us breeders have same sire lines (father lines) in our pedigree. So there is a lot of repition. I like the idea of SQL doing the work and only sending necc. This will help my XML goal. Stored procedures: I have just enough reading to know they exist and I will like them. ( have read much of eccomerce book of larrys) Antonio, yes you have the right idea with data returned. Each having an index/key after query complete allows me to place by number into correct div id with my CSS. Thank you both soooooo much for helping. I know my english and comm skills not great. I appreciate your patience.
  16. Embarrassing possibly, but here we go: ie page 20 $peoples= array(); While(list(I'd, name, fatherid, motherid) = mysqli_fetch_array($r, Mysqli_num) { $peoples [id][fatherid][motherid] = $people; find_fathers($people[0]); // back to top of page 19 Function_find_fathers($father) { Global $peoples; For each ($fatherid as $id => $father) { if(isset($peoples[$fatherid]); Find_fathers(peoples[$fatherid]); } } Just a start,.. I don't like the infinite side. Unnecessary. Recursion makes my brain hurt. No matter how I approach I do not see being able to handle father and mother in same function. But that may just be my 'greeness',.. A new horse term: to be green is to have little experience.
  17. Ok Antonio, I know everyone here is brilliant... Pedigree of a horse is no different than a person really. Table:I'd, name, fatherid, motherid. I have a field for gender but I don't think that is necc. If I had some code that worked I would not be here with my first cup coffee. . And on iPad,.. Typing is slow. I have built SELECT statements that do work, they just get really long and ugly to keep up with: 'SELECT I'd, name, fatherid, motherid FROM genealogy WHERE Id = $id' UNION sELECT a.I'd, a.name, a.fatherid, a.motherid FROM a.genealogy WHERE fatherId = I'd uNION,... Not typed correct but this works. To print to DIV tags in HTML I need result to be rows not ul/li. If you think about it in logic, Larry's example is top of pedigree down (example would return oldest known, each child, down to youngest.). My need goes the other way. Start with one single person, find their father and mother, grandparents,.. Etc. array: $people[]= array('id=> $id, 'name'=>$name, 'fatherid'=> $fatherid, 'motherid'=>$motherid) { do something} Need function to use fatherid and return that array, then motherid and that array,. Father of father array, Mother of father, father of mother, mother of mother.. And so on. Does not really matter the final order of arrays as long as there is a consistent index with the position in family. Ie Array[1] is father. I would like to be able to go as many generations deep as I choose. I have been searching Internet for some time but do not find a good clean short example. I like Larrys code language and have many of his books. No different than learning French with a dialect. I think this is worthy of posting. I don't mind being given clues to figure this out by myself. Just point me in the right direction. BHB
  18. I am trying to figure out best approach to a function similar to yours starting pg 18. But I am building an actual pedigree, 3 or 5 generations. 3 generation as an indexed array count to 6 would gather the amount info needed. I have brain fry. seems like this should be really easy. Fields are horseid, horse name, sireid, damid. Sire and dam id are horse id of course. I will be printing into divs rather than ul/li. That is why I need to get accurate return in order. Playing with uksort. Do you think Sire and dam separate or single functions? Any suggestions are much appreciated. BHB
  19. Woke up with some ideas to try. Will write a herd of if else and post to a new page for now. If someone enters a new year born but nothing else they will skip on,.. Post back to same page actually would be best. But if change sire or dam would post to a list no different than your search form, just two at once. I just add radio button and continue the form to a final; carry the gender, year born and original horse ID past second page in hidden fields. Update q on this final page. Then I can work towards getting it on one page from there. Read Ajax grid this am and that can wait!!! Good gracious. Did not like the book example (not yours); GET without validatioins. Scary! Always having fun! I am right brain if you had not guessed by now. Painter... Code warms my brain up. I paint better after a couple hours of studying. Have to go to real work. Will post my attempt.
  20. Ok, say a form (update) has following fields Horse Id is passed hidden Horse name is visual reference Sire name (I'd) Dam name (ID) Gender Breed Year born If there is a thousand names in db a drop select is not the way to go to change sire and or dam but I don't want duplicate entries either. So if either of the sire or dam fields need to be edited I would like to return a page with 'like' suggestions as radio buttons; choose the correct sire dam with option "I don't see the horse" and add new name at that point. From there actual update happens... Many horses could be named X since db covers many breeds. So keeping it simple (without Ajax) maybe I post to new page ,. So as not to get too messy for now. Ififf statement update of sire or dam go this way, else other post.. The iff sire dam would actually be search query returning two radio lists? Can I pull this off in one form? I am working on my road map, what will be my best plan? I could show code for search if you think it helps. Took a break today to start fresh mon. Sorry I am not clear.
  21. I hope this is the right place to ask this question. I have been building a site with pedigrees and using parts of multiple Ullman books. My regular site search is working well returning a table with edit button. I can type in say 'ca' and returns all names with ca in the name. I have year born edit/update working but have not got my father/mother edit/update to work yet. I am asking theory question rather than code question... I do not want to use a drop list to update father/mother because that list will be much too long. (as in 'artist' chapter 17 page 550 PHP6 MySQL 5) I like how my site search is working to make this first list but don't know if it is truly possible to then use it for search/update; all these editable items on one page? To have an edit button next to each item on list seems silly. SHould I be looking at ajax? ... I am trying to wrap my mind around the flow since I figured out that having multiple separate forms per page causes errors I can't seem to manage. Probably OOP which I have not dived into yet. I need a simple solution at this point in my coding career. The recursion functions (chapter 1) still bother my brain and so I just coded each in pedigree with a long query for now. HA! It works and I hope lights go off after writing these long queries..someday. I would like this new search/update to return a list. That should be radio buttons to choose the correct father/mother; I have unknown father and unknown mother as defaults since those names have to be added in database before they can be linked. Usually people start at the bottom and work back, not vice versa. I always ask question when my brain gets fried. Suppose I should wait 24 hours and it will just come to me. But, I am sure there are many ways to approach and just curious if anyone has worked on such search/update; or multiple forms updates per page. Thought about using include files for each father mother BUT I need the originating array id to link to. grrrr... Thanks BHB
  22. I am only a year into programming but have many years CSS.. One minor adaption you might consider is fixed height on some of your boxes. This may limit your sentence length and lead to a few other decisions. Counting characters not necc going to work because of viewer font size settings. Again I am new to php .. Congrats !!!!
  23. Then adding the base URL for module kills the sticky... Grrrr this is something stupid.
×
×
  • Create New...