-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
Don't understand what you mean by "loading files on pages". Can you be a little more technical about this?
- 2 replies
-
- limit
- reduce load time
-
(and 2 more)
Tagged with:
-
I"m guessing that SINCE you don't check the results of the valid_locations query that it has not run, therefor your while loop doesn't run.
-
You need to add another for error checking to actually show you them. ini_set('display_errors', '1'); This will show the error types that you selected in the previous line on your screen. Be sure to turn this off before putting into production. And then to correct your first error: The message is telling it doesn't expect to see the "session_start();" line. That's because you didn't finish the line above it. Needs a semi..... In the future - you'll get better response if you use a topic title that better describes your problem - please help is just so newbie-ish.
-
Issue with inner join and where statements
ginerjm replied to hydraulicpump's topic in PHP Coding Help
Do you have error checking turned on?- 1 reply
-
- inner join
- where statements
-
(and 2 more)
Tagged with:
-
huh?
-
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.
-
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.
-
Only if you have a date in the records that have been posted.
-
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.
-
Sorry - can't help you. Good luck.
-
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.
-
Your php code is buried in the middle of html.
-
So - now you know what your problem is. Can't find a script that you want to include
-
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
-
Why didn't you show us the error messages?
-
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.
-
And that's why you are the programmer and we are the reviewers. Besides, I don't think many of us understand your scenario.
-
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.
-
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)
-
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.
-
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)
-
convert entire php/html page to dowloadable pdf
ginerjm replied to Kova_Llano's topic in PHP Coding Help
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 -
And what is the problem? You really don't know what that message is telling you?
-
Where are your classes properties defined?
-
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.