What I am trying to do:
For every row of data, show the data and place a line underneath each row, except for the last.
Any ideas why this is not working? In my example above, only 3 rows of data are returned, however all 3 are getting the same div class (newsLine_bottom) applied to them, where-as the last one should be getting the alternate div class (newsLine_noBottom).
Okay. I will trust you on that then. I was taught nothing could be between the “<?php” and then the reference to session. It does make sense to me though that it just needs to come before any output.
I get the following error: Warning : array_values() expects parameter 1 to be array, object given in /home/cabox/workspace/minisgallery/Live_Files/index.php on line 425
Why would my above query not be returning the results as an array?
I thought $stmt = $pdo->query($sql); would generate an array of the results? Or is that not what this does?
Well to say I have much confusion in this area is an understatement. I originally began doing queries as per the manual, however then I was shown the delusions manual and the query format there is different. I now do all my queries as per the delusions examples.
I have now spent 3 hours today trying to get this simple @#$#ing query to work. I’ve read the manuals so many times, that they no longer make sense to me.
Thank you for the “var_dump” method… I spent 20 minutes Googling how to get the value for my array and none of the results mentioned var_dump.
I have restructured my query now and it appears to be working fine:
Incidentally - the answer to your problem is actually probably better solved with a better targetted CSS rule than using code to give it a different class.
Thank you for mentioning this option. I’m not overly familiar with CSS and I thought last-child could only be used on things such as lists that are contained within tags.
:last-child refers to the last element inside any container. <html> is a container (and usually, the <body> tag is its last child)… anything that has an opening and closing tag and contains other elements will have a :last-child match.
Keep in mind that :last-child matches the last CHILD, not necessarily the last matching element.