Jump to content

SaranacLake

Members
  • Content Count

    63
  • Joined

  • Last visited

Everything posted by SaranacLake

  1. SaranacLake

    Need a dynamic Subform

    I want to build a webpage where an employee can key in an order, including the order details. Building an entry form for just the order is easy enough, because it is simply one webpage with a set number of fields. And when you need to enter in a new order, you simply load a new blank form. But the order details part seems trickier, because one order can have one-to-many order details, and so I need a subform that expands as more items are entered. For instance, let's say this is in a restaurant, and a large group of people walk in. There is no telling how many items they might order, but I would need a way to let the waiter keep adding items to their bill as long as necessary. On the web, I'm not sure even where to begin with this?!
  2. SaranacLake

    Need a dynamic Subform

    Does this website not support BBCode? (It's a real PITA to use...) > ginerjm's reply wasn't about a static form with x predefined sets of input fields. > it was about entering one line item of data at a time, submitting the data (where it would be validated, > so you can correct any errors as they occur), and then presenting an empty set of input fields for the next data item. > the already entered data items would be shown with edit/delete buttons. Okay, I follow you/him now. The problem is that I don't want to do things piecemeal because that isn't how you'd do data entry in the real world. If this was for an order, at the top of the page you would enter customer and order information, and then below that on the same screen you would enter the order details for as long as necessary. (It would be insane to enter the customer and order info, click "Submit", and then get another page to enter the 1st item out of 100 items, click "Submit" and then get a another screen to enter the 2nd of 100 items and so on!!) With just PHP, you would either have to hard-code in A LOT of blank line item fields or do what you are are proposing, but neither really represents how the real world works, which leads me to think I need Javascript - which i don't know.
  3. SaranacLake

    Need a dynamic Subform

    If I understand you, that is the design I am trying to avoid, i.e. a static order details form with a finite number of entry fields. Let's say this was for Walmart and not a restaurant - although the problem exists in either - and Customer A buys one banana. That is easy to design a subform for that, - I could just have 5-10 slots and I'm safe. But let's say that Customer B is buying a monthly order for their family of 15... There could be HUNDREDS of order details, and you just cannot program a static subform and *hope* there are enough slots - plus it would look sloppy. How hard is Javascript to learn? While I want to keep learning, what I do NOT want is to get stuck spending learning Javascript all summer long. If I accept this new project, I would need to turn around a working prototype in under a month, and then once I have someting that at least works, then I can more easily invest time to becoming a Javascript guru while I work on version 2.
  4. SaranacLake

    Need a dynamic Subform

    Thanks for the reply. My background is with databases, so yes, I feel very comfortable with the data model part. It's just that I have been away from programming for several years, and my web programming skills are "light" (e.g. I don't know any of the fancy Javascript stuff). When I did used to do web development, it was mostly html pages/forms and serverside PHP, although I think I even forgot how to do that! As far as the database part, just doing this on the fly, I'd likely have this... CUSTOMER - id - and so on... ORDER - id - order_date - vendor - location - subtotal - discounts - taxes ORDER_DETAILS - id - order_id - product_id - unit_sale_price - quantity PRODUCT - id - name - description - unit_price - category - and so on... What I really need help with is figuring out how to build a control for the order details that acts like a spreadsheet where you can keep adding row after row as long as the customer is ordering more items.
  5. SaranacLake

    Need a dynamic Subform

    I guess you answered one question, in that I need to handle this on the client side, right? As far as your comments above, I'm not sure I entirely understand what you mean, since I don't know Javascript. How difficult would it be to learn how to do all of this? I have a good idea in my head what I want, but am just unsure where to begin since this is on the web.
  6. SaranacLake

    Plans & Promos

    My website allows users to purchase various membership plans which in turn gives them varying degrees of access to content and features. I was going to create a "membership_plan" table and call it quits, but then the marketer in me stepped in and posed some interesting questions... - What happens when a given "membership_plan" has a price change? How do you keep track of that? - What happens when a given "membership_plan" has a change to its features? How d you keep track of that? I am more concerned with how do I manage evolving "membership_plans" with what has already been sold?! For example, maybe I sell @requinix a "Platinum" plan today for $50/year, but then this summer i add in free podcasts in that plan, and decide to increase the price to $70/year. I need some way to make sure that Requinix doesn't see a price increase, because he should be locked in for $50/year until the end of his term. The more i think about this the more of a mess it becomes. I suppose all of this is more of a database question, but I figured i would ask it hear since it is also a programming rpblem. I am thinking I have data entities here like: MEMBERSHP_PLAN and PROMOTION and maybe PLAN_HISTORY or PLAN_DETAILS? Looking like there is a many-to-many here, but I could use some advice on how to build this out?! Thanks!
  7. SaranacLake

    Plans & Promos

    I decided to go with a m-to-m before you posted. Similar to a textbook Orders ==> Order Details <== Products set up where you have a unit_price and a sale_price, I will do the same (as you also suggest) to allow me the ability to keep track of what price I sell a subscription at to an individual.
  8. SaranacLake

    Taking the leap to MVC

    After many, many years of struggling, I would like to finally learn how to separate my website's PRESENTATION from its LOGIC. I have been working on a startup business for over a decade now. And one of the reasons it is taking me so long to build my website from scratch is because I am a horribly INEFFICIENT PROGRAMMER!! On one hand, I think I write solid business logic. But considering that each of my scripts averages between 1,000-2,000 lines of code, that is a monster to manage. (My website is over 50,000 lines of code at this point. All home-grown and hand-coded.) While it is hard to manage things while I am actively coding, what kills me even more, is when I get pulled away for months (or recently for 2 years), and then later on when I come back, it is a nightmare to load all of that code into my brain?! I mean if you read any of my scripts starting at line 1 and going through line 1,500 I think it reads pretty well. But who in the hell can keep track of all of that in one reading? It's certainly a struggle for me!! I definitely wantto strive for more of a "component archtecture" approach. (On a side note, I have heard "good" Object-Oriented programmers claim that if a class is more than 100 lines of code then it is too long?!) So anyways.... My #1 priority for v2.0 is to learn and master separating my website's PRESENTATION from its LOGIC using something like MVC. (And after that, my goal is to finally learn and master Object-Oriented Programming, but one thing at a time!!) I want to finally learn how to program like a *professional* coder. (A very successful and RICH professional programmer!!!) 🙂 So, can all of you gurus out there, please help me get started with a solid Model-View-Controller introduction and/or resources and/or advice?? I know the Internet is littered with this topic, but like anything done well, you need to find good learning materials and at least one or two good mentors. After all, if MVC and OOP and whatever were so easy, then everyone would be doing it, and doing it well. (And of course you realize that very few people actually do things like MVC and OOP well!!) So my goal is to become a "jedi", but I will need some good teachers to get there...
  9. SaranacLake

    Taking the leap to MVC

    And your answer to my other questions?
  10. SaranacLake

    Taking the leap to MVC

    @requinix, What about you? Can you recommend some books or websites or other sources where I can learn world-class MVC development? And do you agree that my next step should be mastering MVC before OOP or other things?
  11. SaranacLake

    Taking the leap to MVC

    Is the Fowler book agnostic? Will it work for Python and Java as well as PHP? Do I already need to understand MVC or OOP prior to reading it? Also, can you recommend some exceptional books (or online resources) for learning *proper* MVC? Based on what I know, it seems that learning MVC before OOP would be the best way to go...
  12. SaranacLake

    Taking the leap to MVC

    I appreciate the offer, but just like any sane business person wouldn't post their business plans online, there is no way hell I am publishing the codebase for my business on the Internet - not even a "private" Git repository. My code *does* work, and I have a viable product, so it's not like I can't code. My objective moving forward is to reduce the time it takes to ship my code. (There is LOTS of room for improvement there!!) It's one thing to post sample code, and clearly I am willing to do that, but to "turn over the keys to the kingdom", even to Bill Gates or Steve Jobs ain't gonna happen! But I am still eager to learn and accept help from others, just not quite on those terms. I'm sure you can appreciate my stance?!
  13. SaranacLake

    Securing 'hidden' form values

    If I store a value in a hidden form control, and then use that as a means to pass the value to another PHP script, could that cause any security issues?
  14. SaranacLake

    Securing 'hidden' form values

    Okay, I see what you are saying now...
  15. SaranacLake

    Taking the leap to MVC

    @requinix, So where is a good place to start learning MVC principles? I'm sure if I Google "MVC", "MVC principles" or "MVC architecture" I will get a million hits. (And if they are anything like info on OOP, then 90% of them are garbage.) So since I don't know the "right" way to do things, then how do I know which sources are teaching me the "right" way, and which ones are taking me down a path of failure?
  16. SaranacLake

    Securing 'hidden' form values

    Why am I making things complicated? The user is on page A, then choose a membership plan in a form, and it sets a value in the session that is then used on my checkout page. Not following you...
  17. SaranacLake

    Plans & Promos

    Fair enough! Psst... I created a most excellent thread asking for help on MVC... 😉
  18. SaranacLake

    Plans & Promos

    I see your points, except for maybe the last thing... if the only thing that changes on a plan is a rate change, then should I create an entirely new (and basically identitcal) plan just for the rate increase from say $50/yr to $55/year? I could do this this... MEMBERSHIP_PLAN -|----|<- PRICING_HISTORY That way if the price goes up of down I'm covered and don't have to muck up my database with clone records. However, to your earlier point, if things like features change, then sure, create a new record in MEMBERSHIP_PLAN with a comment like "Platinum (Winter 2019)", "Platnum (Summer 2020)", etc. Yes or no?
  19. SaranacLake

    Best way to escape PHP code

    I haven't coded HTML or PHP in several years and am trying to get back into it. Seems to me that there were some nifty tricks so that when you were conctenating HTML and PHP you didn't get a birds nest. Maybe it was using something like { } but I don;t recall. I also seem to recall that wisely choosing where to use single (') and double (") quote was key! For example, how could this code be cleaner? echo '<table id="membershipPlans"> <!-- Column Groups --> <colgroup> <col id="feature">'."\r"; foreach ($plan_names as $p_id => $p_name): echo '<col id="option0'.$p_id.'">'."\r"; endforeach; echo '</colgroup>";
  20. SaranacLake

    Plans & Promos

    But doesn't that create a lot of fragmentation? Because now I have "Platinum_v01" and "Platinum_v02" and so on in my database. I was thinking something like this would be better... MEMBERSHIP_PLAN -||--------|<- PROMOS or MEMBERSHIP_PLAN -||--------|<- PLAN_HISTORY The idea being that the "Platinum" plan for the msot part is the same old "Platinum" plan, but the price will certainly change over time and maybe a few features.
  21. SaranacLake

    Best way to escape PHP code

    It sounds like what you are ultimately describing is like Model-View-Controller design, right? My entire website is built off the one script, two-parts paradigm you mention. Now, my entire website is not in one script, but for each logical part (e.g. account registration, log-in, upload photo) I have a dedicated PHP sript where the top half looks to see if the form was submitted and any other logic, and then the bottom half is basically a pass-through where i display the HTML and any needed PHP variables as you mention. Probably my #1 goal for v2.0 is to FINALLY learn how to code "like a real man" *LOL* and learn how to separate the "presentation" from the "logic", because that is why my website development now moves at a snail's pace - it's so damn hard to manage!!! This could be a thread unto itself, but since you briught it up, do you have any advice on that topic? (And should I start a new thread, or can you relabel this one, because i would *love* to get some advice on how to become a better - mor elike "smarter" - PHP developer!!)
  22. SaranacLake

    Storing images

    Is it a problem storing images in MySQL? Long ago I heard it would blow up a non-enterprose database like MySQL. Is this still a concern?/
  23. SaranacLake

    Storing images

    True. Any idea the order of magnitude when it comes to directory limitations regarding file count? My VPS is on a Linux box. Are we talking thousands or tens of thousands of images, or something dinky like 500? Basically i am trying to figure out how much time I have before it would become an issue. And since I haven't built anything like this in my code and filename scheme, what would I do when I reached a limit? I mean it's easy to say, "Well design it right the first time?!" But if I listen to every person every time that comes up, I will *never* finish this website!!! If I can just complete the ecommerce module for this site in the next month or two, i can finally go live after years of pissing around. I am hoping I have 3+ years with my current design, which should give me enough time to build a much more robust v2.0 Thoughts?
  24. SaranacLake

    Storing images

    Yes, my script does all of that much more. I guess i was asking more from a management standpoint. See that is why i am thinking that storing images in MySQL would be advantageous... Right now I just have a naked file sitting out on my Webserver, where it doesn't seem like I have much control. If it was in a database, I would have controls that restrict how images can be ADDED, DELETED, UPDATED, and there would be metadata telling me when things happened. I'm not sure if you culd argue whether backups and recovery is easier if the images are on the webserver or in a database. Anyways... I am not arguing your earlier advice, but just following up to see if there are any other controls I should add to protect things. It's one thing to have 100 product image files in a directory, and quite another to have 20,000 member rofile images in a directory?! That is what I was asking for as far as DO's and DONT's.
  25. SaranacLake

    Best way to escape PHP code

    So it looks like you leave the HTML alone and just code the PHP as the exception? (Whereas the sample I posted tried to encapsulate everything as a PHP echo. What about those magic escape characters I'm trying to remember? { } maybe? I think you use those with variables or arrays or some special place to keep your echo statements clean? Ringing any bells?
×

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.