
rockwood
Members-
Posts
416 -
Joined
-
Last visited
-
Days Won
10
Content Type
Profiles
Forums
Events
Everything posted by rockwood
-
i am the big hater of : global $db, $set;
-
PHP is still going strong, and Laravel, combined with Breeze, takes it to a whole new level of simplicity and power.
-
-
Glad to see MySQLi is still in use!
-
I'm glad to see this community remains active and that most members are ready to support one another.
-
I used to code for the community, but life got pretty busy. Now I’m ready to dive back in—and if anyone’s interested in joining, I’d be really happy to collaborate. I’m restarting the project and plan to be super active with it!
-
looks impressive
-
welcome here Ollie
-
V2 is slightly better than V1, but it still needs significant improvements. However, it’s a good fresh start, and we need to work harder on it.
-
The "chmod" command does not work in a standard Windows CMD because it is a Unix command, not native to Windows; to use "chmod" on Windows, you need to either use a Unix-like environment like Cygwin or the Windows Subsystem for Linux (WSL) to access its functionality.
-
This website has been suspended. If you are the owner of this website, kindly contact your hosting provider for more information.
-
<script> export default { data() { return { userNavigation: [ { name: 'Your Profile', href: '/profile' }, { name: 'Settings', href: '/settings' }, { name: 'Logout', href: '/logout', method: 'post', as: 'button', type: 'button' }, ], isMenuOpen: false, // Toggle for dropdown menu }; }, methods: { toggleMenu() { this.isMenuOpen = !this.isMenuOpen; }, closeMenu() { this.isMenuOpen = false; }, }, }; </script> <template> <div class="relative"> <!-- Trigger Button --> <button @click="toggleMenu" class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-md focus:outline-none"> Menu </button> <!-- Dropdown Menu --> <div v-if="isMenuOpen" @click.outside="closeMenu" class="absolute right-0 z-10 mt-2 w-48 origin-top-right rounded-md bg-white py-1 shadow-lg ring-1 ring-black/5 focus:outline-none" > <MenuItem v-for="item in userNavigation" :key="item.name" v-slot="{ active }"> <Link :href="item.href" :method="item.method" :as="item.as" :type="item.type" :class="[active ? 'bg-gray-100 outline-none' : '', 'block px-4 py-2 text-sm text-gray-700']" > {{ item.name }} </Link> </MenuItem> </div> </div> </template> <style> /* Add custom styles as necessary */ </style> try this way
-
Ah okay
-
I am very surprised that we are still using this kind of global variable in 2024. Why aren't we considering dependency injection? For Example: <?php // Define a Database Connection interface interface DatabaseConnectionInterface { public function connect(): PDO; } // Implement the Database Connection using PDO class DatabaseConnection implements DatabaseConnectionInterface { private string $host; private string $db; private string $user; private string $pass; public function __construct(string $host, string $db, string $user, string $pass) { $this->host = $host; $this->db = $db; $this->user = $user; $this->pass = $pass; } public function connect(): PDO { try { return new PDO("mysql:host={$this->host};dbname={$this->db}", $this->user, $this->pass); } catch (PDOException $e) { throw new Exception("Database connection error: " . $e->getMessage()); } } } // Define a User Repository that uses the Database Connection class UserRepository { private DatabaseConnectionInterface $dbConnection; // Constructor injection of the Database Connection public function __construct(DatabaseConnectionInterface $dbConnection) { $this->dbConnection = $dbConnection; } public function findUserById(int $id): ?array { $pdo = $this->dbConnection->connect(); $stmt = $pdo->prepare("SELECT * FROM users WHERE id = :id"); $stmt->execute(['id' => $id]); return $stmt->fetch(PDO::FETCH_ASSOC); } public function createUser(string $username, string $email): void { $pdo = $this->dbConnection->connect(); $stmt = $pdo->prepare("INSERT INTO users (username, email) VALUES (:username, :email)"); $stmt->execute(['username' => $username, 'email' => $email]); } } // Client code to use the repository function main() { // Database credentials $host = 'localhost'; $db = 'your_database'; $user = 'your_username'; $pass = 'your_password'; // Create a Database Connection instance $dbConnection = new DatabaseConnection($host, $db, $user, $pass); // Inject the Database Connection into UserRepository $userRepository = new UserRepository($dbConnection); // Example: Create a new user $userRepository->createUser('john_doe', '[email protected]'); // Example: Find a user by ID $user = $userRepository->findUserById(1); print_r($user); } // Run the main function main();
-
-
Xampp is outdated technology you can move on wsl2
-
i can do
-
use appropriate background with suitable animation for make it better in my opinion do you remember criminalimpulse game? Significant improvement is needed here. Using $global is not a good idea; it's better to use Dependency Injection (DI).
-
I am 41 now me too love build something
-
Introducing Gladiateurs Battle - A Strategic Turn-Based Combat Game!
rockwood replied to HanGPIErr's topic in Game Projects
lovely work -
Introducing Gladiateurs Battle - A Strategic Turn-Based Combat Game!
rockwood replied to HanGPIErr's topic in Game Projects
What did you use to create this?