Jump to content

All Activity

This stream auto-updates

  1. Today
  2. If you're not running this in Docker, or perhaps even if you are, it sounds like your database configuration wasn't set up properly. Check the hostname you have it using.
  3. Hi all. I encountered a problem in my laboratory work on web technologies. When I use the php artisan migrate command I get the following error. Illuminate\Database\QueryException SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for db failed: nodename nor servname provided, or not known (Connection: mysql, SQL: select table_name as `name`, (data_length + index_length) as `size`, table_comment as `comment`, engine as `engine`, table_collation as `collation` from information_schema.tables where table_schema = 'db' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name) at vendor/laravel/framework/src/Illuminate/Database/Connection.php:813 809▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 810▕ ); 811▕ } 812▕ ➜ 813▕ throw new QueryException( 814▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 815▕ ); 816▕ } 817▕ } +48 vendor frames 49 artisan:13 Illuminate\Foundation\Application::handleCommand(Object(Symfony\Component\Console\Input\ArgvInput)) I am using ddev. MacOS. I've already tried everything and don't know how to fix it. Who knows how to fix this?
  4. Is that missing one? The version I know has 11 "had"s. Though 10 works too, it's just changing which boy was correct. There's also the classic "buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo" (needs punctuation and capitalization), but that can totally be stretched out further - like pretty easily to "buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo buffalo". I should go looking for some puzzles too...
  5. 'til now they have been mathematical so here's one that's purely grammatical Q4 Correctly punctuate this sentence so that it makes sense the two boys had written very similar essays but peter where paul had had had had had had had had had had been preferred by the teacher
  6. Welll done. I knew you'd do it. Hint for others:
  7. That wasn't the answer? No way, that totally was the answer Then I'm thinking 11 twigs.
  8. Yesterday
  9. Your foreach() loop expects several items and that each will be put into $row as you loop through. But get(cart_item) only returns a single item so when you use foreach() you are looping through its properties Try $row = Session::get("cart_item"); echo <<<ITEM <tr> <td width="70"><center>{$row['ItemCode']}</center></td> <td>{$row['ItemDesc']}</td> <td width="70"><center>{$row['ItemQty']}</center></td> <td width="70"><center>{$row['ItemAmount']}</center></td> <td width="70"><center>{$row['ItemTotalAmount']}</center></td> </tr> ITEM;
  10. Thanks you so much, i couldn't see the wood for the trees i'd put $cartItems = $itemArray; instead of $cartItems[] = $itemArray; before setting the session Session::set("cart_item", $cartItems);
  11. Sorry am getting PH FLEXI FRAME EXTENDER FRAME 370373 1 210.92 210.92 So why is it putting everything on a new row!
  12. I know its a different item because i cleared the session in case it was that but when i if(!empty(Session::get("cart_item"))) { print_r(Session::get("cart_item")); foreach(Session::get("cart_item") as $row) { print_r($row); } } for the session i'm getting Array ( [ItemDesc] => PH FLEXI FRAME EXTENDER FRAME [ItemCode] => 370373 [ItemQty] => 1 [price] => 210.92 [ItemTotalAmount] => 210.92 ) but for the row i'm getting PH FLEXI FRAME EXTENDER FRAME So where are the other keys and values going?
  13. Are you saying that if you foreach(Session::get("cart_item") as $row) { print_r($row); } then you get... for each item?
  14. I'm trying to create a shopping cart but am having trouble retrieving the results and my head is about to explode. The array has been created because when i print_r or var_dump it i get Array ( [ItemDesc] => JOULE 300L AERO COIL [ItemCode] => 118710 [ItemQty] => 1 [price] => 4764.54 [ItemTotalAmount] => 4764.54 ) but when i call the array <table class="table table-striped"> <?php if(!empty(Session::get("cart_item"))) { foreach(Session::get("cart_item") as $row) { ?> <tr> <td width="70"><center><?php echo $row['ItemCode']; ?></center></td> <td><?php echo $row['ItemDesc']; ?></td> <td width="70"><center><?php echo $row['ItemQty']; ?></center></td> <td width="70"><center><?php echo $row['ItemAmount']; ?></center></td> <td width="70"><center><?php echo $row['ItemTotalAmount']; ?></center></td> </tr> <?php } } else { ?> <tr> <td colspan="5"><center><span class="rounded-pill p-1 px-5 bg-secondary">No Purchase Order Items Data Available!</span></center></td> </tr> <?php } ?> </table> I am getting the following error Error on Apr 22, 2024 22:25PM - Attempt to read property "ItemCode" Does anyone have any suggestions please I have also tried <tr> <td width="70"><center><?php echo $row->ItemCode; ?></center></td> <td><?php echo $row->ItemDesc; ?></td> <td width="70"><center><?php echo $row->ItemQty; ?></center></td> <td width="70"><center><?php echo $row->ItemAmount; ?></center></td> <td width="70"><center><?php echo $row->ItemTotalAmount; ?></center></td> </tr> But its throwing the exact same error
  15. That wasn't thinking outside the box, that was a cop-out. The woodchuck was just slower than the others collecting his twigs. There is a (none-zero) solution.
  16. Speaking of thinking outside the box,
  17. I love shortcuts too but damn, that one is just plain annoying 😆 Ah, I envy that ability to think outside the box...
  18. For anyone else out there, feel free to join in. Meanwhile... Q3 Some animals are gathered in the forest having a midwinter party, all seated around a fire. When the fire starts to die down they all move off to gather more wood. The walrus manages to gather 7 twigs and throw them on the fire, the widgeon throws on 21 twigs, the wombat 11 twigs, the weasel 20 twigs and the wolverine throws on 28 twigs. How much wood would a woodchuck chuck if a woodchuck would chuck wood?
  19. I took the integration / volume of rotation route and came up with the solution.
  20. Yay added the spoiler button. Been a long time since I've done integrals, so I first tried the brute-force solution to make sure I had the right answer. With that out of the way, the integral. It's actually much easier regarding the sheer math work, but requires a little more thinking to get it. That's more interesting math than I've ever had to do as a (web) developer. Actually, with maybe one exception... but I don't remember quite what it was so whatever.
  21. Last week
  22. Thanks guys, I've changed it all over to PDO and finding it a lot easier. I decided to use MySQLi as I'd previously used MySQL years ago and thought it would be the natural progression and had no idea about PDO.
  23. For some reason that number has stuck in memory for for the last 58 years, which is strange as I sometimes struggle to recall my phone number (the one I never dial). On those occasions when I have doubted my recall I just use my calculator to divide 30 by 17 (which contains the answer as a recurring sequence) to verify. * * * * * Anyone up for another (simpler) one? You have a solid wooden sphere and drill a vertical hole centrally through it. The resulting object is now 6cm high. What is the volume remaining?
  24. Alright, this one took me a while to remember how to do. It's part of a class of problems of manipulating one number's digits to come up with another number, and the work to solve it tends to have a common pattern.
  25. I know that 17 is going to be important, but my brain blew up before I could get further. Not really seeing any shortcuts that could help... I'm thinking it's a big number.
  26. i also recommend the much simpler and more modern PDO extension. you can directly fetch data from a prepared query, the same as how you would fetch it for a non-prepared query. if you are going to use the mysqli extension, forget about mysqli_int/mysqli_stmt_prepare. just use mysqli_prepare(). also, forget about the num_rows property. just fetch the data and test if there was any fetched data. if you are querying to find a row of data matching an (active) user, you would not include the password comparison in the WHERE ... term. also, you should be using php's password_hash() and password_verify() for password hashing. php finally realized the it should use exceptions for errors for things like database statement errors. as of php8, the mysqli (and PDO) connection, query, exec, prepare, and execute calls throw exceptions for errors. this means that any conditional error handling logic you have for these statements can be removed since they won't ever get executed upon an error, simplifying the code. there's also generally no need to close prepared query handles, free up result sets, or close database connections in your code, since php destroys all resources when your script ends, simplifying the code. pdo version - $sql="SELECT * FROM users WHERE username=? AND active=1"; $stmt = $pdo->prepare($sql); $stmt->execute([ $uname ]); if($user_data = $stmt->fetch()) { // a row was found // you can reference elements in $user_data, such as $user_data['id'], $user_data['added'], ... } else { // no row was found }
  1. Load more activity
×
×
  • 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.