Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jessica

  1. Well, your complaint is that it's printing all the numbers up to $number_pages. You want it to print up to $num_pages_list. You also are starting at 1 right now. You say you want to start at the current page. There are two things to change.
  2. To use it later. I suggest you do some reading on OOP. Find a book and go through it.
  3. I don't know why you put the A.php in front of your function call, but otherwise close. Your if is messed up too. Please use code tags when you post code. <> button.
  4. ... You should only call the login_form() function when your form has been submitted. Not every single page. When the form is submitted, it will go to the file which is designated in the action attribute of the form element. That page should check to see if the form was submitted by seeing if $_POST['submit'] (or whatever you called the button) isset. If isset returns true, attempt to login.
  5. You should only call that function when the form is actually submitted.
  6. It's a magic function, PHP just knows. It's magic. :-P . Like that. And the reason it's better is once you have more than one file to include, you have now reduced your code significantly.
  7. Have you ever tried it? Because I have. I installed slim on my localhost in a non-root directory, and I didn't have to change a thing. It worked fine.
  8. if you want each tile to be at a specific position, and there is no other criteria ordering them than your given order (ie, it's not by date, name, etc), then you must store the order that you want.
  9. Seriously. If your directory structure is different, then you simply update the code to work with it, or update your directory structure. It's not rocket surgery.
  10. Nitpick: The OP didn't specify that he wanted a calculator. He said he wanted to take two numbers and show the result. The result of WHAT is yet to be defined.
  11. for($i=1; $i <= $number_pages; $i++)Fix that line. If you know what it does, it should be fairly easy to change it to what you've just said you want it to do.
  12. I think OP means more like just a box, like Windows calls their new interface "live tiles".
  13. You cannot have two HTML elements of any kind with the same ID. Your HTML looks correct because the selects have different ids. You can try passing each ID to your function, after you re-write the function to accept IDs. However, to select all select elements, you can use 'select'. Then use jQuery to iterate over them.
  14. Okay, don't even bother trying to do it that way. Pass the values to the function. Plus, a function shouldn't really echo anything, it should just return the data. You don't need a function to do what you're trying to do, just the foreach() wherever your values are already defined. Stop using global completely. Forget that word exists.
  15. Tiles. Not titles. OP: Your table that stores the information should have a column (called something like orderBy [but not order because thats reserved]) and you can order them in there, then ORDER BY in your clause. You can look at creating a nice interface for actually ordering them using jQuery's sortable plugin.
  16. No, he's not. The single quote is right where it needs to be, after the query string.
  17. OMFG. Do I have an example. Well for one thing all I told you do to was READ THE DOCUMENTATION. So the EXAMPLE is at php.net This is why I hate when I write code for other people. You're not even willing to do the work yourself to learn what you did wrong.
  18. echo "<td><a href='hotels-in-sharm-el-sheikh-egypt-with%20roadmaps-maps-locations-and%20landmarks-diving-boat-trips-excursions.php?q=" . $row['name'] . "'>More Information</a></td>"; It looks fine in our syntax highlighter. Get a better editor.
  19. What does this have to do with regular expressions? I'd suggest using a third-party application for a shopping cart. But if you want to go through the trouble of doing it yourself, you need to learn to code using current best practices. Use PDO or at least mysqli. Don't randomly close and open PHP for no reason. Don't put variables in strings for no reason. You've got a lot to learn.
  20. A. Use Code tags. (The <> button) B. This is WAY TOO MUCH CODE. $week = (strtotime(date('Y-m-d 00:00:00',time())) / 7 * 86400) % 6;You're creating the current timestamp, converting it to a string for midnight of this day, then converting that BACK into a timestamp. Then dividing it by 7 and multiplying it by 86400 (So you're trying to get a week's worth of seconds here, you already did some math), then getting the remainder when you divide it by 6. WHY ARE YOU DOING THIS INSANE THING? You need to go read the documentation for date() because you are using it way wrong. There is a format parameter to get the current week. It will be way more accurate than your method. C. You also need to read on what modulo does. Any number % 6 can NEVER produce/equal 6. D. You're repeating the same thing over and over regardless of what week it is. You're doing the opposite of what programming should be - you've made way more work for yourself. <?php $week = (date('W') % 6)+1; echo "<b>Woche {$week}</b><br> <br> Montag Woche {$week}<br /> Dienstag Woche {$week}<br /> Mittwoch Woche {$week}<br /> Donnerstag Woche {$week}<br /> Freitag Woche {$week}<br /> Samstag Woche {$week}<br /> Sonntag Woche {$week}<br />"; Or even: $days = array('Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag'); $week = (date('W') % 6)+1; echo "<b>Woche {$week}</b><br><br>"; foreach($days AS $day){ echo "{$day} Woche {$week}<br>"; }It depends what you intend to do next really.
  21. You'll want to look at AJAX. Try jQuery.
  22. That is the exact same question you already posted.
  23. In the future, please post just the relevant code here, in code tags. You also need to better describe your problem. What "never gets through"? What part of your code is the problem? Try some debugging by doing a print_r($_POST) before your if(isset()) part, and see just what part isn't set. Also use && not and.
  24. I feel ya
×
×
  • 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.