Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. ginerjm

    safety

    And PLEASE use the proper code tags on this forum. Read the rules!
  2. ginerjm

    safety

    Just by looking at the size of this query, your table design may need some re-thinking as well. I see several repeated fields - formul#, wwspel#,overigew#..... If you are trying to store multiple groups of the same data in one record, you mis-understand the whole concept of relational databases. One should never have multiple copies of the same "data" in a single record. Rather than putting 4 values of formul# in one 'main' record, the 'main' record should link to a second table that will contain 4 records that will be part of the 'main' record. By having a 'main' record id of some sort, you can then put that id into the second table and use it to 'join' the two tables in a query and end up with all the data you need for that 'record id'.
  3. $con is not in scope inside your function. Either make it global or pass it in as a function parameter And - I think you want to remove the single quotes from the value $date. And - you probably need backticks on the field name date since date is probably a reserved word
  4. I'm guessing that either movie_id is not the field name or it is not defined as numeric value.
  5. null given suggests that the query call failed. Add this: $r = mysqli_query($q, $dbc); if (!$r) { echo "Query did not run - error msg is: ".mysqli_error(); exit(); } while ($row = mysqli_fetch_assoc($r)) { ... One should always CHECK the results of things to be sure they ran. Also you should not have a semi after the while statement.
  6. Try "$row['movie_id'] instead of $r['movie_id']
  7. ginerjm

    safety

    Huh?
  8. In your lines after the prepare call you build an array with a set of php vars. Where are they provided with values? And what I meant about providing a value - you are grabbing $values items from your foreach loop but how do those input values get validated and then placed into the simple vars you are using in the array of inputs for the query? Your foreach only creates a $values element for the inputs that are found in the POST array. That means that $values will not have anything to validate nor to populate the corresponding var in the array of inputs. Getting deeper and deeper.....
  9. My last post on this matter. You are spending a lot of time trying to create something and having trouble because it is all so new to you. There is nothing like the feeling of getting that first script working to your satisfaction. This new method you are trying would be a wonderful thing to accomplish I'm sure, but you are showing a lot of confusion in trying to build it at this time. One of the most important and most tedious parts of developing is pulling the data together and ensuring that it is what you expect, what will work, and isn't going to harm you. Repetitive code chunks all doing similar things to like fields are a fact of life UNTIL you get to the point that you understand all those nuances of 'editing' and can at that time build yourself a working machine to help you accomplish this now and for the future. My point is - why not take the time to write the code needed to complete this script, learning all the things that need to be done for each field and learn from it? Then take that knowledge and use it again on your next script and gain more knowledge and when you get to the point that you feel comfortable building a sensible, efficient and safe tool, do it. Beginning coders always look back at their work from their early projects and wonder WTH they were doing. Don't belabor this project with attempts at code that you may regret investing so much time in.
  10. Ok - so now you are pulling in the input from post and stroring it in values for later use. But at this same time you need to be doing the validations and grabbing the correct error messages and storing them somewhere to be used in your html. And as others said, you need to be doing the specific type of validation that each field requires. I also noticed in your original post (of this new method) that you are just using simple vars in the array of values which I don't see being defined anywhere. Forgot something else? And remember - you have to have a value for every ? you placed in your prepared query statement and currently your logic doesn't handle that, unless you add code to ensure that every field is input.
  11. What is the $values array? Perhaps you meant to use $_POST as your array name, not $values?
  12. Are you that worried about electricity outages where you are? Data saved in the session or in the db will be saved since both are at the server, not at your clients. And yes - if the data is saved in either you can re-build the input for the users from either the session or the db. From what you are saying this form is so long it takes the users too much time to complete and you must be worried that the clients will 'time out' and lose everything they are working on . To me that indicates that I need to build my pages differently.
  13. 1 - you need to use something other than the MySQL_* functions since they are deprecated. 2 - you need to either use the newer database functions that support prepared queries or sanitize your input filename before using in your query. 3 - why do you use $filename when you already have a perfectly good variable in $cdocdocb? 4 - if you put out a header that says the upcoming output is a pdf, why would you expect html to be recognized? 5 - if you are seeing the html but no pdf, then I suspect that the filename is either invalid or unreachable. View the source of your page as it is being displayed and show us the line where the img tag is. You do realize that you CANNOT reference a file that is outside of your web tree in html?
  14. Why not simply make the form shorter and let them take a break between multiple input pages? Then you can simply use one script to collect all the data (in batches) and store it in a table or session array and post it when the process is complete.
  15. And the function is buried inside a block of code of an if statement. Never done that myself - suggest you move the function for the sake of clarity at the least.
  16. You haven't defined the function yet when you make the call.
  17. What do you think that message is telling you????
  18. 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
  19. 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.
  20. 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
  21. 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.
  22. 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.
  23. 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.
  24. Maybe someone else with some more knowledge of making browsers handle pdfs will chime in.
  25. Try using the file_get_contents function instead of the readfile one.
×
×
  • 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.