Jump to content

requinix

Administrators
  • Posts

    15,289
  • Joined

  • Last visited

  • Days Won

    436

Everything posted by requinix

  1. Would be nice to see some code... How will the code know what email address should be added in?
  2. WebSockets are also a possibility. They're more complicated to set up, but the advantage is that they're specifically designed to exchange messages like this: you start request to do something, socket emits periodic messages about progress, and it all closes down when complete.
  3. Try to understand what the code is doing when it comes to sending API requests to MailChimp. It's sending a certain request body right now which is not entirely correct. You need to modify that body it's trying to send to be more correct. So some questions for you to answer include "how am I sending API requests?" and "what and where is the request body?".
  4. Your school does not allow people to ask for help on the internet. How do I know that? Because you aren't the first to ask. It's especially bad that you're asking for a solution instead of help to find the solution, so I'm not going to redact the images you've posted.
  5. This should really be handled by the web server, not by PHP.
  6. You have an $operations array but there needs to be an "operations" in the request body too. As in the body looks like a PHP array of ["operations" => $operations]
  7. There might be some fancy Javascript method, but barring that, you need to have some part of the page that does not change when clicking on links or whatever. For the most part, websites nowadays solve that with the majority of the site served through a Javascript frontend - rather than browsing to site1.php and site2.php and whatever like normal, the browser is told to request those files in the background and then Javascript places it into the page. It looks like regular navigation, to some degree, but the browser never actually "leaves" the first page. Frames can still work, though. There is a way to communicate between the different frames: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
  8. array_map doesn't pass the array key. You could call it with two arrays (the first of values and second of keys) but that would reindex the array. array_walk with the value by-reference would work. As would a simple foreach loop.
  9. You already have a thread for this.
  10. OP has requested that this thread be locked due to school policies regarding assignments.
  11. The first step to putting it into HTML is describing what "put it into HTML" means to you. Or in other words, describe your problem in a way that someone who knows absolutely nothing about you or your application would be able to understand.
  12. What kind of variables do you want? Where did they get their values?
  13. I thought you said that you wanted to expand a node after filling in the tree. That isn't an event: you have code to fill in the tree so add a bit of code after that happens to expand the node.
  14. It's weird you mention that because the very same documentation you couldn't find says that's exactly what you're supposed to do. Could it be that your question isn't so much "how" but rather "why does this method call not work"? Where are you putting that code? Where did "node" get defined? Any errors in the browser's console?
  15. You've fixed things but you haven't fixed things. Like these: if(isset($_POST['d_name'])){ } if(isset($_POST['manner_death'])){ } if(isset($_POST['place_death'])){ } if(isset($_POST['nok'])){ } if(isset($_POST['rel_nok'])){ } if(isset($_POST['morgue_att'])){ } What are those doing? Nothing. They don't do anything. Then you have if(isset($_POST['tag_num'])){ if(isset($_POST['treatment'])) The first line makes sense, but the second? Without a pair of { } then it will only run the very first line of code that comes after: the assignment for $d_name. Then in your query, $query = "insert into data ( d_name, manner_death, place_death ,nok, rel_nok, morgue_att, tag_num, treatment) values ( '$d_name'.'$manner_death','$place_death','$nok','$rel_nok','$morgue_att','$tag_num','$treatment')"; you managed to fix the one syntax error but you created a new one. You cannot create websites by putting code in your editor and hoping everything will work. You have to make actual, conscious, deliberate decisions about the code. You have to know what different pieces of code mean. You have to understand why code is what it is and then how you can use it to accomplish what you want. So before you try to write more code, stop and take a few days to learn what you can about PHP. Then come back to this file and put some thought into each line of code in it.
  16. I don't know what my code would look like because I don't know anything about your application. The first problems to solve are the ones that are quite visibly wrong. Such as how you have a couple lines of PHP code that aren't within the <?php ?> tags. And those crazy if statements ginerjm mentioned. And the syntax error in your INSERT statement.
  17. I count thirteen problems with this code. Throw it out and try again.
  18. What have you tried so far?
  19. Exactly what is he saying you should do and what are the reasons for it?
  20. You already have something that will print information if it's available. What's more, it makes sense: if you have $iptc data then print what's in it. Logical. Obviously, that then means that if you don't have $iptc data then it won't print. Also logical. So then, if you don't want it to print anything, you need to make sure that "you don't have $iptc data" is true. Thoughts on how you can make that happen?
  21. Your question is "How do I make a food delivery app like foodpanda" and no, that's not really a good question. It's not the kind of question that can be answered to any reasonable sort of degree. Do you have maybe some specific questions?
  22. Have you tried adding code to check for and handle errors? Especially when it comes to the stuff using cURL.
  23. Convenience, mostly.
  24. In Docker-land, Find the Docker image for the operating system Configure the image with appropriate settings Copy the source files to /var/www/mywebsite Install other services Install other services Test the image Drink a beer That there is the process you'd follow to create one of those monolithic Docker images that can do everything you want. What kind of instructions would result in multiple images for discrete services? Download the operating system ISO image and create a bootable USB Go to the garage Boot one computer from the USB and configure it for Apache Copy relevant files to the appropriate Apache location Boot another computer from the USB and configure it for PHP Copy relevant files to the appropriate PHP location Boot a third computer from the USB and configure it for your database Maybe run initialization SQL statements Make sure all the computers can talk to each other Go back to the office and browse the website as hosted on the Apache server Those three computers can translate into three images/containers running on one Docker host. Through Docker Compose, you have all three running and talking to each other. Either (a) you have multiple Dockerfiles for the multiple images, or (b) you use buildkit and have one Dockerfile with multiple stages for the multiple images: Image #1: start with the Apache base image, add/copy appropriate Apache and website configuration (remembering that it will be accessing php-fpm across a virtual network), and copy only the files that Apache needs. Image #2: start with the php-fpm base image, add/copy appropriate configuration, and copy only the files that PHP needs. Image #3: start with whatever database base image, add/copy appropriate configuration, and copy any files it might need. Those will embed your files directly into the image - that's for a real deployment because you don't need to change any files. (If you did, that would be handled with an external volume.) Locally, you don't want files right into the image because that's a hassle, and instead you would use volume mounts so that you can develop outside of Docker and immediately get the changes inside your running container. For the Apache image, your Dockerfile would have something like: FROM whatever base image COPY your general Apache configuration files to the places they need to go COPY your website virtualhost configuration files to the places they need to go COPY whatever public assets and other such website files to the places they need to go ...and that's about it, because the base image will (should have) taken care of most annoying things from installing Apache its dependencies to getting you a reasonable default configuration that you might not even need to change. php-fpm has a little more because the base image isn't everything: FROM whatever base image RUN commands to install additional extensions/features not already provided COPY configuration files COPY source files RUN potentially more installation commands, eg. a composer install The database: FROM the right image, COPY configuration files. In terms of a file hierarchy, yours could look like /apache - Apache-related files /website.conf - virtualhost configuration /public - the web-accessible files that go in the Apache image /index.php /favicon.ico /src - PHP source code /sql - database stuff /vendor - only exists locally, isn't added to the image but instead created by a composer install composer.json Dockerfile (if using multiple stages, or else the multiple files would go elsewhere) docker-compose.yml - for your local development, has the three services with volume mounts and networking setup and so on
×
×
  • 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.