-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
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.
-
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...
-
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.
-
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.
-
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.
-
If you are creating these sets of data maybe you should re-think that process.... ?
-
Using <select><option>?</option></select> to display text.
ginerjm replied to Steve_Berry's topic in PHP Coding Help
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. -
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.
-
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.
-
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.
-
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.
-
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.
-
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?
-
How are YOU connecting $conn to another class? Are you passing it in your calls to their methods or setting a class property?
-
I think you missed something in whatever sample you copied this from. One has to return something to finish the construction.
-
XAMPP - INDEX.PHP DISPLAYING AS TEXT IN BROWSER
ginerjm replied to sdn30studio3's topic in PHP Coding Help
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 -
Is there something missing here?
-
someone show me why this code doesn't submit data into my db table
ginerjm replied to simbae's topic in PHP Coding Help
For one thing - stringing 8 if statements in a row is a HORRIBLE way to try and program. -
fill array with " " to avoid "undefined index" errors?
ginerjm replied to ChenXiu's topic in PHP Coding Help
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. -
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.
-
my website this option show - SITE ERROR: MISSING
ginerjm replied to shahnawaz36's topic in PHP Coding Help
Do you have an actual error message that you can show us? What you did show us has no meaning to me. -
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.
-
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?