Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. What is "dbarray"? Not a function I can find in the manual. Your code only runs one of those queries. Not surprising it only retrieves the ones for today. It also only retrieves one field.
  2. If I read your question correctly, you need to do a query to select the records that match the max(date) of each user. It will probably a query having a sub-query which you will have to read up on.
  3. Only if you have a date in the records that have been posted.
  4. 1 - I have no constants defined. 2 - For the material you presented, the solution is to make a small module of the logon code that you use in any script that needs a db connection by 'include-ing' it. No need for a constant there either. Of course somebody else is going to refute this practice but to each their own.
  5. Did your tutorial tell you to put them there? Interesting that you are following a beginner's(?) PHP tutorial and it starts out with you creating a class (for an un-necessary purpose btw) and you don't even know html yet.
  6. Your php code is buried in the middle of html.
  7. So - now you know what your problem is. Can't find a script that you want to include
  8. WHAT is the error? You expect us to guess what it is? And which lines are those numbers? Suggestion? Define your class outside of your html. It will make it easier to read and debug
  9. Why would a new php person be interested in doing such a trivial exercise? You learn nothing from it. Instead learn how to handle data - including inputs, query results and outputs - properly. It is one of the more important things to accomplish so that your future work is not prone to attack and your database is safe from damage. A simple mathematics problem (100 values - really?) like this is understood and resolved by doing only 4 values as I did - why go further? Unless this is a homework problem and if so, you have used me and I wash my hands. And - for the future - please don't quote entire messages like that. We can see the text in the previous posts. Quoting is meant to single out a specific portion of a post for further discussion.
  10. And that's why you are the programmer and we are the reviewers. Besides, I don't think many of us understand your scenario.
  11. The programmer in ME wouldn't let this go without a stab at it. $nums = array("A"=>10,"B"=>20,"C"=>15,"D"=>25,"E"=>40,"F"=>50,"G"=>5); $target = 80; $results = array(); foreach($nums as $k1=>$v1) { if ($v1 == $target) { $keys = $k1; $results[$keys] = $v1; } else { foreach($nums as $k2=>$v2) { if ($k2==$k1) continue; else { if ($v1+$v2 == $target) { $keys = array($k1,$k2); sort($keys); $keys = implode('',$keys); if (array_key_exists($keys,$results)) continue; $results[$keys] = "($k1) $v1 + ($k2) $v2"; } else { foreach($nums as $k3=>$v3) { if ($k3==$k1 || $k3==$k2) continue; else { if ($v1+$v2+$v3 == $target) { $keys = array($k1,$k2,$k3); sort($keys); $keys = implode('',$keys); if (array_key_exists($keys,$results)) continue; $results[$keys] = "($k1) $v1 + ($k2) $v2 + ($k3) $v3"; } else { foreach($nums as $k4=>$v4) { if ($k4==$k1 || $k4==$k2|| $k4==$k3) continue; else { if ($v1+$v2+$v3+$v4 == $target) { $keys = array($k1,$k2,$k3,$k4); sort($keys); $keys = implode('',$keys); if (array_key_exists($keys,$results)) continue; $results[$keys] = "($k1) $v1 + ($k2) $v2 + ($k3) $v3 + ($k4) $v4"; } } } } } } } } } } } echo "For a value of $target the answers are:<br>"; foreach ($results as $v) echo "$v<br>"; // It is rather mechanical and I'm ABSOLUTELY POSITIVE that some php genius out there will come up with a shorter method, but this code will do combinations from 1 to 4 values. I'll let you figure out how to incorporate 5, 6 and 7 values into it.
  12. Since you didn't understand my last post in English, let's try this. Go back to my post showing you the code and examine it CLOSELY for where the periods are located. (Hint: they are in the css snippet only)
  13. oops - just realized that you are allowing for more than 3 elements in a combo. Have to do as many loops as there are individual nums and check the sum in each loop.
  14. The trick would be to use 3 nested loops, checking that you are not summing like indices as you go. Have fun! (It's a typical programmer's task)
  15. Don't understand what you mean about adjusting table content. With fpdf you design the output the way you want it. If you want to do a table it's not much different than an html table. Just set up the widths of the columns to be on your pdf report and use them for each of the cells in each row of the pdf table. No different than the <col> tags of an html table
  16. And what is the problem? You really don't know what that message is telling you?
  17. Apparently you have never learned any CSS. A class name in a CSS definition looks like what I gave you: ".color1" where there is a period in front of the name.
  18. While I agree with trq's opinion on the job of being a programmer, I'll give you a hint. How about you add a field to your task record so that only the user that created it can update it?
  19. You needn't have posted all that code.... The error is telling you that the script you want included is NOT where you are saying. Perhaps the folder structure on this server is not in line with the structure on your old one. Anyway - it's simply a path issue.
×
×
  • 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.