I saw this on google maps, and I had to check it out. I'm staying in Berkeley with my friend Alice, and she helped me find it. Thanks for the awesome picture framing/taking skills Alice!
Random Handstands with MySQL and CSS Fix
Well, it turns out that the “Random” handstands you see on the right were actually not all that random. They weren’t showing any from my roadtrip or beyond which was puzzling. I still don’t know exactly why that code didn’t work, but I have some that does now, which is less efficient (but works)!
For anyone who is a MySQL guru, I wanted to determine the MAX id, and then generate a random id off of that. Then using that id, retrieve the information.
I accomplish it by making 2 calls now:
- Call 1 (Getting a Random id):
- SELECT FLOOR(MAX(id) * RAND()) FROM `$this->table` LIMIT 1
- Call 2 (Getting the properties out for that id):
- SELECT `id`, `title`, `description`, `small` FROM `$this->table` WHERE id = $rand_id ORDER BY id LIMIT 1
How do I make a query that works in one shot, but accomplishes the same thing?
My About page was looking messed up as the footer came up and swallowed the entire page. I ended up fixing that thankfully though too. Yay for fixes!