Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. And so I learn.... Would be nice if people mentioned WP in their post...
  2. I give up. At least we agree that your current logic sends out 1 email per bill so you have to alter your method. As for the above being your "whole script", I disagree and won't ask again. And I still don't understand why you use username as both the salutation in your body (Dear $username) and as the email address: $mail->addAddress($username); // Add a recipient Doesn't make sense. Good luck.
  3. I have no idea what you are asking. Maybe you should re-read your post and try again?
  4. Your code is spaghetti and thus very hard to read, let alone interpret. Where is the actual query that produces the results that you want to sort differently? Have you tried altering the 'order by' clause of your select statement? You should really learn to structure your script so as to place the logic (php) at the top and produce php vars of dynamic data and then place those vars into a cohesive block of html code at the bottom. Makes for better maintenance and readability. That way you can write cleaner lines without going in & out of hph mode all the time. One should also write code one statement at a time and not consolidate things into single lines. Again - readability.
  5. 1 - I agree that it will send the all the bills. I was just pointing out that you will send multiple emails instead of just one. 2 - your error reporting is turned off. See my signature for how to do it correctly. 4 - from your post #15: Sounds to me like you are saying that "username" is a NAME and not an EMAIL And lastly - can you not post the entire proposed cron job from start tag to finish so that it can be examined? Do you know what the proper hashbang line is for you installation?
  6. So the problem exists because of a poor database design. Combining values in a single column is not the way to store data. Anyway try this: if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { // break up the values at the + sign $myResults = explode('+', $row['assignTable']); foreach($myResults as $d) $myVals[] = trim($d); } }
  7. #1 you say moving on. So your current script is going to send multiple emails to a customer if he/she has multiple bills. #2 It would be nice to see the error checking code #3 & #4 Since you have not made a cron job yet, I wanted to see the whole script to be sure it is correct. If you don't want to show us that as I asked, then I guess we're done here. PS - if as you say that the username column is a name then how can you use it as an email address?
  8. This line: redirect("$_SERVER[php_SELF]?interface=login; Is not valid code. And "redirect" is not a php command. Perhaps there is a function somewhere in your code called redirect. In that case show us that as well as a corrected line above.
  9. A mock query would look like: $q = 'select d.department, a.id, a.class, a.time, a.xxx, a.yyy.... from classes a, departments d where a.id=d.id order by department'; This would give you all the records in table a (I call it 'classes') and the department name for each class from the departments table (d).
  10. Everybody has their own way of connecting to their db. To each his own. If your code makes you happy then it's perfect already!
  11. 1 - While your message refers to multiple bills you do realize that you are sending ONE email for EACH record(aka 'bill') that you retrieve? Moving on... 2 - where do you turn on php error checking? 3 - where is the rest of the script? It is important to see it for a cron job examination. 4 - have you ever done a cron job before? PS - is the column 'username' really an email address as you later imply?
  12. This is a PHP forum. Mostly for help with PHP. Perhaps someone here has some experience with the using basic auth headers ( I know I tried and failed at one time!) that can help you.
  13. Don't they give you any code to use? Or is this supposed to be a manual connection only? Have you researched on how to do basic auth using php? Or do you just want us to do it for you? There is another forum here that does work-for-pay if you are interested.
  14. Show us the EXACT script you have setup as the cron job. You can hide any passwords. And PLEASE remember to wrap your code in the appropriate forum tags.
  15. Since you can't seem to explain in plain English what you want to do without mixing in things you don't yet know about, how about you show us the code you have already written. Of course if you have never written any code, then you have a learning curve to follow before you start trying to do this thing.
  16. My question is still awaiting an answer. If you want help you have to cooperate with those trying to help. Perhaps you could show a bit more of the context that you are describing to us.
  17. Turn on php error checking (see my signature) and run this NOT as a cron job. Put some debugging lines in there to ensure that things are happening correctly and work on it THAT way until it works as desired. Then set it up as a cron job and test it by sending yourself the email still.
  18. What kind of "code" did you place "after the head and before the body"? Html? Js? Php? Hopefully not php.
  19. It's not a question of being 'user-friendly' but being more understandable to yourself and anyone else who reads your code, such as forum members trying to decipher it. To elaborate on my suggestion about using an id as the key. Create a 'header' table that defines each label and assigns an id number. You could use an auto-increment column in this to help keep it unique. Your process would add a record to this table and retrieve the newly assigned id. Then you would have a table with this id as the key and the rest of the columns being the attributes about this label. Be sure to design your columns to contain simple data types only - no combined values in a comma-delimited string because you have several of them. If you need to do something like that you create another table to keep multiple values in separate rows all having the same id. This would apply to purchase transactions perhaps where you would have a record of each one stored under the id all retrievable with a query on id. When you want to find a whiskey you query the header table and let the user pick a name. You then use the corresponding id in your next query to retrieve al l the attributes from the 'details' table. A brief description but an accurate representation of how a RDBMS works
  20. Perhaps you could re-post your code in a more readable format? One line per line of code is the norm as well as using this forum's code tags to make it more clear. You should also learn a bit about css and get all that clutter of styles out of your html by just assigning one class to a tag instead of all the stuff you are currently doing.
  21. Two things I noticed in your style. You should use more meaningful names for your column names. 'name', 'date' and such are so vague. Even more so is your use of 'id' as the input value and then comparing it to a 'name' field in your where clause. Which is it - an id or a name that you are searching on? PS - using a column name of 'date' might give you a problem in your query since date may be a reserved name. What is the date - a 'purchase date', a 'date added', a 'date distilled'? Plus using a name as the key field will be a real problem if indeed you have truly different whiskeys with the same name and you want to store data about them each and not make them entirely un-searchable. A simple sequential number assigned to each distinct label would be the way to go and then assign that id to every record pertaining to that label from that point on. Requires two tables of course, but that is how the db should be structured.
  22. You probably mean to say $row['avg']. But you also may have to do this: AVG(price) as avg
  23. That's the idea. Although if this will be your first cron task, I suggest you write a script to do all the work while interacting with your console until you have it debugged. Use your email address to prove it out with results info and then eliminate any debugging outputs before setting it up to be a cron job. I use an email to do my debugging of cron tasks. I output all my debug info to a separate message body and then send out the debug email to my address to test my program and watch what it is doing. Once I'm through I disable the debugging email by turning off a switch in the top of the script.
  24. How about you take a look at what the actual query statement looks like in each situation and decide for yourself what needs to be changed? Do an echo of the query after it is built and make sure you are building the 'correct' statement.
×
×
  • 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.