prepare("SELECT id FROM farmers WHERE email = ?"); $stmt->execute([$email]); if ($stmt->fetch()) { $errors[] = 'An account with this email already exists.'; } } catch (PDOException $e) { $errors[] = 'Database error. Please try again later.'; error_log($e->getMessage()); } } if (empty($errors)) { try { $hashed_password = password_hash($password, PASSWORD_DEFAULT); $stmt = db()->prepare("INSERT INTO farmers (full_name, email, phone, district, password) VALUES (?, ?, ?, ?, ?)"); $stmt->execute([$full_name, $email, $phone, $district, $hashed_password]); $success = 'Registration successful! You can now log in.'; } catch (PDOException $e) { $errors[] = 'Could not create account. Please try again later.'; error_log($e->getMessage()); } } } ?> Register - Smart Farmer

Create an Account

Already have an account? Login here