Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. Why are you doing the 'prepare'? You have no values in the query that need to be prepared. Try just running query instead of prepare/execute
  2. You could use JS to trigger a submit every so often. Or Ajax to push all the data to the server without disturbing the user.
  3. You need to establish the proper timezone for your appl. Add this at the top of every script: date_default_timezone_set("America/New_York") Use the appropriate name for your own timezone. Look here: http://www.php.net/manual/en/timezones.php
  4. I think the approach should be to provide a button to do that but do it on the server. Maybe create a table to hold the form element values and some kind of key for the user to provide in order to return to work.
  5. Are you asking "how to do a file download"? Are you suggesting that your script automatically download a file onto a user's hard drive? Seems like a script I wouldn't want to be running on my machine if it is going to be putting things on my drive.
  6. I do not believe that is the problem. A folder is a folder - nothing more. No magic about 'cgi-bin'. To prove that you could create another folder (outside of your web tree) and you will get the same results probably. I don't know why the sample I gave you works for me (with 3 diff browsers) and not you. It's something to do with your browser or something you are doing to the sample I gave you.
  7. Maybe someone else with some more knowledge of making browsers handle pdfs will chime in.
  8. Try using the file_get_contents function instead of the readfile one.
  9. Well, you need to work on that. As for your code - kind of odd looking. All of your "images" code is in ONE list element tag?
  10. So - what have you tried??? Have you downloaded lightbox and read the docs and TRIED to use it???
  11. Deprecated! Deprecated. Say it 3 times fast. In a way MySQL is "depreciated" or ever under-appreciated but the true term for what has happened to the interface is "deprecated'. To quote that well-known mantra - "there is no I in deprecated".
  12. I won't shout - you're doing good. Ok - don't know why the browsers are so different for you. I have tried the code below EXACTLY as I've posted it in IE10, Safari, and Chrome - all on my PC. They all work mostly as expected. The only problem is that Chrome seems to position my pdf way off center inside the div/object area - but at least it displays it. Here's the code. Do this as an experiment. Simply provide a pdf filename to the $filename var in my code and upload it to your site and use this as a simple test of "showing pdf and html" in a webpage. Don't worry about reading the table and getting the name for now. This is just a test. If it works for you then you can build your real logic into it. <?php $filename = "firehouse_ad_hvvfa_sample1.pdf"; $code=<<<heredocs <!DOCTYPE html> <html> <head> <title>pdf in a page</title> <style type='text/css'> #pdf { position:relative; float:left; width: 300px; height: 300px; margin: 1%; // border: 2px solid red; } #pdf p { padding: 10px; } #pdf object { display: block; border: solid 3px red; } </style> </head> <body> <!-- begin DIV to hold the PDF --> <!-- begin DIV to hold the PDF --> <!-- begin DIV to hold the PDF --> <center> Version 5 <form method='POST'> Click here to close this and go back <input type='submit' name='btn' value='Return'> </form> </center> <br><br> <div id="pdf"> heredocs; echo $code; echo "<object data='" .$filename . "#scrollbar=1' type='application/pdf' width='100%' height='100%'><p>It appears you don't have a PDF plugin for this browser. No biggie... you can <a href='$filename'>click here to download the PDF file.</a></p></object>"; //toolbar=1&navpanes=0& echo "</div></body></html>"; exit(); Good luck!
  13. I said to remove 'tags' - so remove the other one also. What's this about about 'no pdf reader'? You never mentioned that before. You said your pdf took over the whole page. Now you're telling me that you aren't seeing the pdf at all? When you've made all my suggested changes (headers out; file reading prior to html coding; checking for errors when reading the file) please post your complete code again.
  14. Remove the header tags Stop suppressing errors (@) on your commands. If there IS and error, don't you want to KNOW about it???
  15. You HAVE no html. Just the div with the pdf in it. ps - read the pdf file into a var BEFORE you begin your html and check that it read ok. Then just place that var into the object tag.
  16. You begin by looking in your db for a certain numbered value. You don't bother to check if your query ran successfully though, nor do you even check if you had any rows returned before retrieving the first row. (Bad practice!). But then it gets weird. Assuming that you get rows back (more than 1) you echo out messages that say your search argument was found AND that successive ones were found EVEN THOUGH YOUR QUERY COULDN'T POSSIBLY HAVE RETURNED ANYTHING BUT THE FIRST ONE. PS - I'd turn on php error checking to ensure you're not doing something wrong with that echo message. Also - you are incrementing $number as if it is a number when you keep making it a string.
  17. Add this right after the query call and before the fetch call: if (!$result) { echo "Query did not run - ".MySQL_error(); exit(); } I really don't like your where clause. Didn't know you could use a select as the object of an 'in' clause
  18. Prove to yourself that the value you are using to open the file has something in it - add an echo of $_FILES['file']['tmp_name'] PS - you should ALWAYS check the results of a query or a file open command to ensure that it was successful.. If you had done that here you would have only shown that one error.
  19. If you had posted the code, we could see it. Some of us don't click on links that we are unfamiliar with.
  20. How about using google? I found this in about 2 minutes. some css to size the div that will hold the pdf image #pdf { width: 50%; height: 300px; margin: 2em auto; border: 2px solid red; } #pdf p { padding: 1em; } #pdf object { display: block; border: solid 1px yellow; } Here is the html that displays the pdf image <center> <form method='POST'> Click here to close this to back <input type='submit' name='btn' value='Return'> </form> </center> <br><br> <!-- begin DIV to hold the PDF --> <!-- begin DIV to hold the PDF --> <!-- begin DIV to hold the PDF --> <div id="pdf"> <object data="firehouse_ad_hvvfa_sample1.pdf#toolbar=1&navpanes=0&scrollbar=1&page=1&view=FitH" type="application/pdf" width="100%" height="100%"> <p>It appears you don't have a PDF plugin for this browser. No biggie... you can <a href="firehouse_ad_hvvfa_sample1.pdf">click here to download the PDF file.</a></p> </object> </div> <!-- end DIV --> Obviously you will have to code something to handle your 'return' or 'close' button, but this works for me.
  21. What evidence do you have for us that things are not happening? ps - I have seen some posts somewhere that suggest that your header is malformed. Try: header("Location: with a space after the colon and then the address you want.
  22. Not even close. I want to see what gets echoed out from your query statement when you add this line: echo $query_question; // ADD THIS LINE RIGHT HERE AND THEN PASTE THE OUTPUT TO THE FORUM. $question_info=mysql_fetch_array($query_question);
  23. echo out the query statement before you try and run it so that we can see the ACTUAL query being submitted. BTW - please tell us what you refer to 'question number displayed'.
  24. index names should have quotes on them. Plus - one should ALWAYS check (!) the results of a query to be sure it actually ran. Add this: if (!$query) { echo "Query did not run - error msg is: ".MySQL_error(); exit(); } after your call to MySQL_query. PS - you REALLY should use a different interface to your db, The MySQL_* functions have been deprecated (not depreciated) and are soon to be removed. Start learning mysqlI or PDO and use it.
×
×
  • 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.