Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. Try turning on php error checking properly for a development environment. See my signature. And as Frank B says - you should always do a check of the result of what I call 'external' function calls - such as interfacing to the MySQL db, or with the file I/o system, etc. Programming (good programming) designs in the means to handle any situation. The failure to handle possible errors in these cases leaves a big hole in your code.
  2. Why did you bother to post all that pure (bad) html code? It doesn't help us if you previous example matches this one in substance. There is no php in it so what does this post do? BTW - your submit button doesn't have a name. How is your php code supposed to properly recognize that YOU submitted the form?
  3. Frustration? You are apologizing for you "frustration"? How about your language?
  4. The OP has already said "he has code that works" and that he's happy, despite several incredulous responses
  5. It appears to me that the OP copied this code from (perhaps) multiple places and doesn't have a clue what it is he is running.
  6. Barand, And what are you telling me? Adding a comma as a "field delimiter" for an output line that consists of a single field doesn't generate a comma in the output. At least it didn't in my test of the OP's code.
  7. You're happy with this code? Really? To me - it doesn't do anything that you started out to do. 1 - You name the file ".cvs". I thought you wanted a csv file? 2 - You write out error messages using a foreach statement that surprisingly works even tho it doesn't read very well. For future work try doing it this way instead of using a statement that is difficult to comprehend: foreach ($error as $msg) echo $msg; using "$error as $error" reads poorly and while it works it will cause endless concern to anyone reading the code. Plus - why even bother with an array of error messages when you only have one error condition?? 3 - You build an array out of your output values with an extra "empty" element. Why? 4 - You output each element of your array as a new line in your (supposed) csv file. Why do you call it a csv file when there isn't a comma to be found in it and there is no structure to the file that allows it to be treated as a csv file would normally be treated? 5 - Lastly - you build an array of the 6 (7?) values you want to output. Then you iterate thru each ONE of them and write code that is supposed to create an array out of each of them (huh?) and pass that to the fputcsv call. Do you think before you write code, or is this just something you copied from somewhere? And why are you happy with a (supposed) .csv file that is simply a list of 7 lines with one piece of data on each? All in all this is a seriously confounding piece of code. Sure it does something, but what and why is beyond me.
  8. If you're fourteen then you have a lot of learning to do - both in PHP and in life. Try listening to what people here are telling you and then do the homework to LEARN. Read the manual. Learn all about the functions. Google prepared statements and how you are supposed to write them and supply values to them. And when you declare that 'it works' be prepared to show us exactly the code you used in its entirety. Don't be in such a hurry to accomplish some small task - take the time to learn how to use this language and platform the proper way so you will be smarter at the end of this project. Please take this advice seriously - I'm not 14.
  9. But that is exactly what you need to do. Do not worry about the size of your tables. That's what RDMS are designed for. Besides all you will have in the assigned-tasks table will be the tasked and the userid.
  10. Your problem could be in the db design, not in your programming. It is generally not recommended to have db fields/columns containing multiple pieces of like data. In your case you are talking about storing multiple tasks, comma-separated, within one table column. The correct design (normalized) would be to have users in one table then tasks assigned to those users in a second table, in a one-to-many relationship. The task table would have the task id and the user id as two fields which you then can query directly and join to both the users table for user data if necessary, as well as a new taskname table for descriptions of the tasks. table users - userid, username, other user data table taskname - taskid, taskname, other task data table tasks - tasked, userid, date assigned?, date completed?, etc.
  11. Ok - that is an html table. Sql results are not in a table (they are in a 'resource') until you output them as part the data in an html table. (Semantics are VERY important in the IT realm.) So - now you can consider my previous suggestions - or not. BTW - isn't this display idea going to make viewing a little troubling? Personally if I'm viewing a set of data that is homogeneous I want to see it in a clear format, not have to make my eyes wander from column to column to find like items which this format will cause.
  12. That is why one should ALWAYS CHECK RESULTS of an operation. If you had you would have seen that False being returned by your query call. Basically your query is flawed.
  13. "an sql result table"? Do you perhaps mean an html table? Assuming that is what you meant to say, I would say 'No'. An html table doesn't have that facility (afaik). So - how to do this? Well - how important are 'column alignments once you decide where a specific row should being (on the x axis)? If no so important you could simply display each row in different divs which have specific left margins set to do what you want. If important, then you might do it with the same divs scheme but with individual divs defined for each 'column' that are then output inside of each 'row' div. Psuedo-like-this: <div id='left-row'> data </div> <div id='right_row'> data </div> Or: <div id='left_row'> <div id='col1'> col1 data </div> <div id='col2'> col2 data </div> <div id='col3'> col3 data </div> </div> and so on.
  14. Glad you got it working. Now you need to work on your html and stop using long-ago deprecated attributes and practice secure procedures. no more font tag filter your input before using it and before echoing it in your output.
  15. How about re-describing your intentions without using your current design details? Not understanding your goals from your prior write-up
  16. So - perhaps you can re-write your question using the same terms throughout to make it clearer what you want to do
  17. You mention 3 links. Then you mention 3 URLs. What is the connection or isn't there one?
  18. Means your connection is not good or you are not using the 'connected' variable to access the function. Show us the code
  19. Apparently not. If you are getting the error somethings not defined.
  20. You need to turn on display errors to see any possible faults in your code. As for what you want to do, I don't see it here. You write a query using values that 'we' have no idea about, you run this query but don't check if it succeeds before grabbing results from it. Basically we don't see what's wrong here, nor do you.
  21. So? You simply don't want to publish your user's email addresses on the site - that's why you want a 'fake' address displayed? I would do that with a db table that creates a record for the fake address that you assign and link it to a real address for the user.
  22. While I don't see why you want to track many of these things the way you are, I most definitely think you should user the php error log for your last items, not a db. Read up in the manual on how to trigger error messages of your own design into the error log.
  23. Huh?
  24. Thats an important thing to pgm for! Try sending a hidden field with ur form having a random value in it. Save that 'token' in ur session Then when the form is submitted check that incoming value against the saved session var. Of course one should always validate all input at the server anyway
×
×
  • 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.