Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. What is "at"?
  2. The cron job would be triggered by an app I already have. When I run that quickie to post an activity my plan is to setup the one-time cron job to run at a specific time later on and that's it. No juggling here and not very complex. I put in a little bit of time researching how to do this. Then I decided to ask around.
  3. I try to avoid the unnecessary. If I know when I need the task to run I"m trying to make that happen. Thanks for the help tho...
  4. That's the thing I'm trying to avoid. That means having an hourly(?) execution to check a table(?) for some indication to do what needs to be done. A lot of wasted executions.
  5. Has anyone managed to create a cron job on their hosted domain from a running script? I have a task that I do repeatedly and I would like to run a quick script that records the happening of that task and that then posts a new cron job to execute at a certain time to remind me via an email or text message. That latter part I have written. It is just the creating of the cron job that I am asking about. Setting it up via my cpanel is just a pia and not something I am going to even consider.
  6. Since you are discussing the inputs from a POST call, it might help to see the real html code. Extract is not normally used also.
  7. If you are creating these sets of data maybe you should re-think that process.... ?
  8. Try this instead $select_tag = "<select onchange='reload(this.form)'>"; $select_tag .= "<option>test one</option>"; foreach ($data as $output) { $select_tag .= "<option>" . $output['header'] . "</option>"; } $select_tag .= "</select>"; Now - in your html area simply place the $select_tag var where you want this html to show up.
  9. Proper database design would never use a comma-separated list of items in a field. It would be done as a group of records in a different table that holds the user's id number to connect them all to that subscriber.
  10. You add error checking to things that matter. If you are trying to open a file, check if you did. Running a query? Check for the results. Echo out an error message of your own and then exit. Any errors from php that you have asked to see will now show up on their own. You don't put the exit with the ini settings.
  11. With the ini settings you are making the errors will display automatically. Simply do the exit when you check for errors. I don't think you need to set the 'startup' setting since you are not doing any startup.
  12. A Session var won't work since each player has a separate session. A cookie could work but a table entry as described in the article from DanEthical would work better. Assuming that you already have some kind of players table storing info about him/her, you could simply add a logged-on field to that table and turn it on when the user logs in. Along with that you need a field that records the last time the user interacted with the system. Every time that a user hits a page of the app, you would need to just update his players record with the current time. Then a check for who is currently on would simply be a query for records with the logged-on field set and having a recent time which is determined by you, the designer.
  13. A Fetch returns a Row of the results, not all of the rows like a fetchall would do. Each row then has the individual fields that were requested by the query. Most of the time you will execute your query, check if it succeeded and then begin a while loop that fetches a row and processes the data of that row.
  14. If you want to continue to use mysql along with pdo, you'll have to make both connections. I suggest renaming your pdo connection to $pdo instead of $conn since you seem to be already using that var. Something like: $pdo = new Database(); Of course what is the point of trying to switch to PDO ( a good move BTW) if you are still going to use mysql code in other parts of your script?
  15. How are YOU connecting $conn to another class? Are you passing it in your calls to their methods or setting a class property?
  16. I think you missed something in whatever sample you copied this from. One has to return something to finish the construction.
  17. And learn to write your code in separate lines - makes it far, far easier to read, interpret and to maintain. Another good plan would be to execute your php code FIRST and then to output the html code with the dynamic parts coming in the form of php vars that you build from that php logic you executed earlier in the script. <?PHP do php stuff like grabbing the posted data. format some results into php vars Now start echo-ing html code and inserting those php vars where you want the generated php results to show up. then exit php. Read up on using the heredocs construct. Makes outputting html and php vars much much easier IMHO
  18. Besides adding the fetch statement, you might want to check if your query returned any results before even trying to do the fetch.
  19. Is there something missing here?
  20. For one thing - stringing 8 if statements in a row is a HORRIBLE way to try and program.
  21. Is the problem having elements with null values or is it that the element does not exist in the array? You make it sound like the latter but are treating it as if it were the former. If you are getting undefined index errors, then the element is not there. Perhaps you could just add a check using isset() to avoid the index error? Otherwise you would have to have some code that knows what elements must exist and have to go thru the array making sure that they are present and creating them if not.
  22. Have you written the html portion yet to show the input fields that you need? That would be a great start. Then you could attach your php script to the html form and work from there.
  23. Do you have an actual error message that you can show us? What you did show us has no meaning to me.
  24. You failed to test the result of the call to 'query'. If you do that you may get an error message that helps you out. Plus - you don't do any validation of the inputs you are getting which means you can be saving bad data in your db. You need to examine your inputs and try to then use prepare statements for your database interactions from now on. Lastly - I suggest that you look up using the PDO interface rather than the old mysqlI one.
  25. Have you not written an html form yet nor used php to process the inputs coming from that form when the data is submitted via a button? Or is the question about the data coming from a textarea tag rather than a simple input tag of type=text?
×
×
  • 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.