Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 11/25/2018 in all areas

  1. 1 point
    @gizmola, You seem to be a drill-sergeant an loving father all in one?! I am very interested in learning how to do all of that, but I also stick to what I said (or implied) above... That being, I have a very large code-base I as working on a couple of years ago for a couple more years, and when I was 95% done, life happened and my work got tabled. My goal is to "finish what I started" and get my existing environment, tools, approach and code-base into prod so I can get my website up and try to make some $$$ while I regroup. (Starting to re-organize a Terabyte of crap on my old Macbook and laying it down in a way that I can actually find things on my new MacBook made total sense. But getting fancy with anything else is likely an unnecessary distraction...) And I am interested, but it was quicker to change a few lines of code in my httpd.conf file then do what you suggested. (For v2.0, I will check that and your other advice out.) There is nothing more than I want moving forward to learn how to code like a modern professional, and start being EFFICIENT, because that is what sunk me the first go around. (I have solid code that works, but it takes me 10 times longer to do and maintain things than it should for me to be successful. And, NO, that has nothing to do with tools, but has a s***load to do with architecture and coding styles!)) MAMP des what I need it to do for now. Took me an evening to research, and a few minutes to type the code to make it adapt to my new filing system. Now on trying to find all of my old code and notes and get my website working in my new dev environment on my new macBook. Thanks for the thoughts!
  2. 1 point
    Barand, Wow! Thank you -- that is fantastic code! I'm going line by line familiarizing myself with proper PDO code. For example, new DateInterval('P1Y') sets it to a period of 1 year, setTime(0,0, 0) sets the time ("timer") to zero. I'm now working on trying to understand how and why this line of code works: "$summary->execute([$start_date])" What worries me is that I never would have thought to do that (I wouldn't have made the leap to knowing that the StartDate input parameter could go in there). I guess that's why they call programming languages "languages" ... because analogous to learning a language, one might ponder, "How would I have known to call an apple an 'apple,' or, an orange an 'orange.'" You just do it! And do it over and over again until it becomes natural and second-nature. Thank you again!!
  3. 1 point
    Using the aformentioned code, these statements work but I don't know how to properly nest them whereby the nested Prepared Query uses data retrieved by first Prepared Query: // Statement One $stmt = $db->prepare(" SELECT YEAR(timestamp_column) as yr , MONTH(timestamp_column) as mno , MONTHNAME(timestamp_column) as mth , DAY(timestamp_column) as da , SUM(salesPrice) as total FROM mysales GROUP BY yr, mno ORDER BY timestamp_column desc; "); // Statement Two $stmt2 = $db->prepare(" SELECT DAYNAME(timestamp_column) as dana , usedPrice FROM mysales WHERE MONTH(timestamp_column) = 11 // hard-coded month AND YEAR(timestamp_column) = 2018 // hard-coded year ORDER BY timestamp_column desc; "); // This works for first statement: $stmt->execute(); $result = $stmt->get_result(); while($row = $result->fetch_assoc()) { echo $row["mth"].'....'.$row["yr"].'...'.$row["total"].'<BR>'; } // This works for second statement: $result2 = $stmt2->get_result(); while($row2 = $result2->fetch_assoc()) { $stmt2->execute(); echo $row2["dana"].'...'.$row2["salesPrice"].'<BR>'; } Nesting them like this "somewhat" works.... but 1.) Seems inefficient, and just plain wrong to execute "$stmt2->execute();" and "$result2 = $stmt2->get_result();" inside a 50000-record "while loop." 2.) Only works for a "hard-coded" month and year (don't know how to pull data retrieved from first Statement.... e.g. hard-coded year "2018" works, but "$row['yr']" doesn't) I don't know what to do...
This leaderboard is set to New York/GMT-04:00
  • Newsletter

    Want to keep up to date with all our latest news and information?

    Sign Up
×

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.