🚀 Hostinger Optimized
🖥️ Server: LiteSpeed
💻 System: Linux in-mum-web1643.main-hosting.eu 5.14.0-611.42.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 24 05:30:20 EDT 2026 x86_64
👤 User: u621169360 (621169360)
🐘 PHP: 8.2.30
🚫 Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail

💻 Terminal

📁 /home/u621169360/domains/agriexpertt.com/public_html/wp-admin
$

📄 fetch_user_medicine_orders.php

📁 Path: /home/u621169360/domains/agriexpertt.com/public_html/mobile/Flutter/fetch_user_medicine_orders.php
📊 Size: 1.38 KB
🔒 Perm: 0644
📝 MIME: text/x-php
<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Methods: GET");
header("Access-Control-Allow-Headers: Content-Type");

require_once 'db.php';

try {
    // Check if user_id is provided
    if (!isset($_GET['user_id'])) {
        throw new Exception("User ID is required");
    }

    $userId = $_GET['user_id'];

    // Fetch user's medicine orders
    $query = "SELECT 
                id, 
                name, 
                phone, 
                state, 
                district, 
                full_address, 
                products, 
                order_date, 
                status 
              FROM medicine_orders 
              WHERE user_id = :user_id 
              ORDER BY order_date DESC";

    $stmt = $pdo->prepare($query);
    $stmt->bindParam(':user_id', $userId, PDO::PARAM_INT);
    $stmt->execute();

    $orders = [];
    while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
        // Decode products JSON
        $row['products'] = json_decode($row['products'], true);
        $orders[] = $row;
    }

    // Return orders
    echo json_encode([
        'status' => 'success',
        'orders' => $orders
    ]);

} catch (Exception $e) {
    // Handle any errors
    http_response_code(400);
    echo json_encode([
        'status' => 'error',
        'message' => $e->getMessage()
    ]);
}
?>
← Back📥 Raw✏️ Edit🔒 Chmod
✨ File Manager Magic ✨