Jump to content

PaperTiger

Members
  • Posts

    16
  • Joined

  • Last visited

PaperTiger's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Have you tried running the script in the browser and seeing if it works then?
  2. Because you set the count as 3 before you unset the first element, so it will always loop through 3 times. You don't really need the count at all. You can just do: unset ($shop[0]); foreach($shop as $item) { echo $item["Title"]." costs ".$item["Price"]." and you get ".$item["Number"]; echo "<br />"; }
  3. I originally had them generated as PDF documents, but found it to be very unreliable no matter what library I used, and it didn't work cross browser either, so I went back to HTML. If they were generated as PDFs though, surely it would run into the same issue of having to sit there loading up an enormous file for hours on end before it would actually print off?
  4. I would advise staying away from Plesk, it's a poor product.
  5. Readability and making it easier to debug later on.
  6. Hi, We have various reports which can be printed off by our staff, for each individual student, which work by generating a simple HTML page and then using the javascript print method on the document load to print it off (or Ctrl+P, whatever it's just a normal HTML page). Pretty standard and simple. However, one of the managers has decided in his infinite wisdom and obsession with printing everything that he can, that he wants to have one button which he can click to print off all reports for every student in the system. Now since these reports are generated at run time, building up the HTML page, I can't see any way to do this other than literally have it create one massively long HTML page with all the reports, which will no doubt take hours and hours to load, and then just print in the normal way. Is there any other way this could be achieved? The only other thing I can think of at the moment is change it so that when a report is generated it saves a copy to a file somewhere, but even then it would still have to load it up in order to use the javascript print method, and there would be plenty of reports that won't have been run yet, so they would still need to be generated, and as php is server side I am 99% sure there's no way for it to communicate with the client's printer to just say "print all these things". Any ideas at all? Cheers.
  7. Could you put the code in code tags? It's much easier to read that way.
  8. If you want to get the array key in your foreach, you can do: foreach($_POST as $key => $value) A few other notes: - Rather than just checking if the value = "", you may want to trim it first. As if someone enters a blank space I would assume you'd want that to return an error about being empty, but it wouldn't because " " != "". There is also a function in php called empty() which checks if a variable is "empty", though depending on the variable type it can produce unexpected results sometimes. - Where you're doing "return array($ERROR_Specify);", you have already said that $ERROR_Specify is an array, so you don't need to then put that array into another array unless you have some other reason for doing so.
  9. If you want to execute a PHP file in the cron, you need to specify the path to the PHP command line interpreter. If you're using linux, this is generally "/usr/bin/php" So the cron would look like: * * * * * /usr/bin/php /path/to/file.php Replacing * for whatever time values you actually want
  10. ^ Pretty much that. All you need to do is pass in the parentID and assign that. Consider: ID: 1 comment: "First Comment" parentID: NULL ID: 2 comment: "Second Comment" parentID: 1 ID: 3 comment: "Third Comment" parentID: 2 By simply specifying the parentID when doing the reply, you can then get a recursive list of all the comments so that you end up with something like: Comments Array ( [0] = Array ( ID: 1, comment: "First comment", parentID: NULL, replies: Array ( [0] = Array ( ID: 2, comment: "Second Comment" parentID: 1 replies = etc...... ) ) ) )
  11. If you want to use php to redirect to another page, you have to follow the "no output before the header" rule. Even a new line or some whitespace will cause the "headers already sent" error because it is output that has been sent to the buffer. Either : A) Get rid of the output before the header call. B) Clear the output buffer before the header call. [more info] C) Use javascript to do the redirect
  12. You'll have to be way more specific as to what you mean...
  13. Try unbinding the click event before you set it: $(function(){ $("a.load").unbind('click'); $("a.load").click(function (e) { e.preventDefault(); $("#pdetails").show("slow"); $("#projd").load($(this).attr("href")); }); });
  14. The password must be blank, otherwise it wouldn't work.
  15. That simply means that there is no file called "mailform.php" which you are telling the form to post to. The "action" of the form should be whatever the name of that file you just showed us is, if you want to post it to the same file, which presumably you do.
×
×
  • 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.