Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jessica

  1. Don't bump your posts. Post your updated code.
  2. Don't do it as a sub-select, do it as a regular join.
  3. Since this is the only question you actually asked in your post, I'm going to go with: Because. Computers.
  4. That is in fact about the farthest you could get from an easy solution.
  5. It's ... Unnecessary ... You know they're tables and its more for you to have to type.
  6. You could just do the math in the query.
  7. Uhm. I just told you about one.
  8. Bootstrap.js has a sticky footer
  9. No we will not help you illegally steal someone else's hard work.
  10. Google Data Normalizing - you're storing the data wrong.
  11. I didn't say anything about any ebooks. This forum is not for copy-paste code, and you can't solve your problem by copy-and-paste. You can solve it with find-and-replace. You don't even need any code. If you want to learn PHP, you won't do it by complaining that you don't know it yet.
  12. You could use a constant to store the name. You could use a variable. You could use a function. A constant is probably best. However any decent IDE should be able to replace all the instances you already have with the new name/constant/variable/function.
  13. I may be going about this all wrong, so feel free to tell me This is my first attempt at using Symfony. I have a controller which generates a form in one action (My "view all" page, it displays both the list of existing and the form to create) and the form processing is in another action ("add action"). In the add action I process the form and add if it's valid. Whether or not it's valid you get redirected back to the view all page to see the form again. I want the processing to be a different action/route in order to prevent submitting again upon refresh, and I just prefer the processing in a different action. The problem is when there is an error, the form doesn't display it, because after redirecting back to the view all action, the form's data is gone. How do I persist the errors/values/etc over multiple actions? I can't find any examples of this in Symfony, it looks like they always do the processing in the same action. I thought first to put the form in the session, but I don't want to store a ton of form objects manually if there's a better way to do this. public function viewAllAction() { $repository = $this->getDoctrine()->getRepository('SageCoreBundle:Service'); $services = $repository->findBy(array('active' => 1)); $this->form = $this->createForm(new ServiceType, null); return $this->render('SageAdminBundle:Service:viewAll.html.twig', array( 'services' => $services, 'form' => $this->form->createView() ) ); } public function addAction(Request $request) { $this->form = $this->createForm(new ServiceType, null); if ($request->isMethod('POST')) { $form->bind($request); if ($form->isValid()) { $service = $form->getData(); $service->setActive(1); $em = $this->getDoctrine()->getManager(); $em->persist($service); $em->flush(); $this->get('session')->getFlashBag()->add('success', 'Service Added!'); return $this->redirect($this->generateUrl('admin_services')); } else { $this->get('session')->getFlashBag()->add('error', 'Error'); return $this->redirect($this->generateUrl('admin_services')); } } }
  14. Accomplish what?
  15. No, your code should prevent them from doing that.
  16. returning false is not the same as not returning anything. Because PHP is loosely typed you can get similar effects but you can also get very different effects. It depends on what you're doing with the result of the function. http://us3.php.net/manual/en/language.types.type-juggling.php http://us3.php.net/manual/en/types.comparisons.php
  17. Because you're only echoing it once, after everything is done. You have two loops, you only need one, and you should echo within the loop.
  18. I have never written a tutorial about PHP Mailer, probably because I've never even used it. You don't have to supply anything like mail.domain.com.
  19. So, no. OP: Post your updated code so we can see what you did.
  20. if(mail ($email, $emailsubject, $body, "From: $fromname <$fromemail>")) is the line that sends the mail. "mailer" doesn't mean anything.
  21. It's already an array, so just pick the keys you want and concatenate them into a string.
  22. Is <p> HTML or PHP? Look at what's different between the code that works.
×
×
  • 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.