Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. So - you have a txt file. What do you want to do with it? You're not telling us anything at all here.
  2. You are creating a PHP function, correct? Code up the function like this: function DoQuery($where) { // the $where parameter is a complete where= clause $q = (your query statement here with the where clause being replaced by $where) (the rest of your process to produce the result return $result; } // build the where clause if ($runDay) $where = (your where clause for Day); elseif($runWeek) $where = (your where clause for Week); elseif($runMonth) $where = (your where clause for Month); // run the query $answer = DoQuery($where); (use the value of $answer where you want it to show up)
  3. It sounds like a good plan. Could be done in one script, or in multiple. Perhaps create 3 connection functions and use them before the groups of queries that access them. The key would be developing that query function (or functions) that can be used over and over again for each of your so-called 'pages'.
  4. As was suggested by CyberRobot - you should work on formatting it so that you can use one set of code for all of your needs to make the whole process simpler and easier to maintain. All that you want from the included file is some data. No need for html it sounds like, altho I don't know how your whole process handles that now. In the end you could have a script that looks like this: (open db connection) (set some parameters to do a query such as table name, values that alter the query results) (call a function to do the query and return the result value) (do something with the results, such as outputting them) (do this all over again with new parameters). and repeat. You'll probably only have one include for the connection logic and another for the sql code.
  5. echo "$num2 | Week"; And remove the echo $num2 from the include-file.
  6. Pages? What pages? Scripts that do the same thing over and over? And they all contain a bunch of useless html that you just want to glean some data from? Doesn't sound like the original purpose of all this effort. Personally I would do what cyberRobot said - dump the html, keep the php/sql logic and wrap each in a function. Open one db connection and then call each function and assemble the individual outputs at the end (or wherever) and output them.
  7. You wrap your simple db query and logic in some html code and then return a result to the main file to be output? Very strange way of coding. So instead of echo'ing that $num2 var, just USE the var where you need it. Like in the other echo that you are executing.
  8. Modify the include file to store a var instead of echo'ing it.
  9. Then you really need to follow my suggestion.
  10. Perhaps using a more universal coding method would work better. Instead of relying on some blind code to output a value for you, why not return the value in a var and then use the calling script to output it as it sees fit?
  11. Now that clarifies things!
  12. Jacques stated initially 'Don't use password_default'. That is what I was questioning. Not the cost.
  13. requinex: This would refute Jacques1 position that one should specify the algorithm and not use PASSWORD_DEFAULT. Hmmm... Of course, the manual also says what you imply - use the default constant and let the authors supply the actual algorithm so that (as you say) don't have to worry about it. I'mmm soooo confused....
  14. Jacques1 - Well said! LovePHP - If you want to help someone in the future, and want to post code, how about posting YOUR code, code that YOU know and can support and not some random script you found. The OP could have easily done that so why do you think that you needed to do that very same thing? We're here to help people with their code and not to be research automatons. Your brief response in #13 shows that you aren't up to this task. We take this seriously. If you wish to remain on this site and wish to be of help, responses such as #13 will not do much to improve your reputation.
  15. You check all the lines? What does that mean? In order to know if something doesn't work you actually have to execute it. As for your html, where did you learn this? You have a label tag linked to a field that doesn't exist. What's the point? Your style on the first input element - why is the width set to 100%? You want that field to fill the page width? I'm not aware of your previous postings, but just looking at this one makes me wonder what your background is.
  16. Do a simple search of your program files.
  17. Cut your losses now. Switch and the saving in headaches will be worth it.
  18. Probably s/b on the sql forum. It's not a php problem
  19. Yes - please post the RELEVANT code so that we can help you. What have you tried to do so far? Mail?
  20. I think your question/statement answers itself. One of your points refers to proper storage of data in general and the other goes right to the heart of the matter when discussing data storage - How to Get It Back.
  21. I may get my head bit off here, but here goes. Data is data. RDBMS is a tool/environment for data. JSON is a tool for passing data - not for safekeeping. My point is - Don't store your data in a db in json format. Store it like you would any data and then when you need to encode it for a purpose, do so with the appropriate function.
  22. I don't like how he mentions "so the user will stay at my site". I hate it when developers think it's alright to do that to users.
  23. And maybe you could do what Good Programmers do and add some COMMENTS to the code so we can follow it. And perhaps you could restructure it so that the php is segregated from the html to make it easier to decipher and follow and maintain. And since the only query execution statement is commented out, maybe you could show us how you are retrieving this data? And when you have solved this problem maybe you could make the transition to a new db interface such as mysqlI or PDO since you are only doctoring up outdated code that is soon going to break and not be useable. So much work to do.
  24. #1 - please post code in the proper code tags #2 - Don't understand much about your question other than "it shows all jobs" #3 - Why do you think we need to see ALL THIS CODE? Can't you pinpoint where you think your problem is? #4 - If I took a guess I would have to say that you need to filter what your query is calling for. Change your where clause to only select what you want to display.
  25. I think Jacques point was to use you 'new' skills to correct the old script. Progress!
×
×
  • 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.