<?php

// Enable error reporting for debugging
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$servername = "localhost";
$username = "antenicenefather_anf";
$password = "363213119.363213119";
$dbname = "antenicenefather_anf";

// Create connection to the database
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Fetch the required fields from the longform table where is_send = 1 and gpt_response_8 is not null or empty
$sql = "SELECT gpt_response, gpt_response_1, gpt_response_2, gpt_response_3, gpt_response_5, gpt_response_6, gpt_response_7, gpt_response_8, gpt_response_9 FROM longform WHERE is_send = 1 AND (gpt_response_8 IS NOT NULL AND gpt_response_8 <> '')"; 

$result = $conn->query($sql);

if ($result && $result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        echo $row["gpt_response_1"];
        echo "<br>";
        echo $row["gpt_response_2"];
        echo "<br>";
        echo $row["gpt_response_3"];
        echo "<br>";
        echo $row["gpt_response_5"];
        echo "<br>";
        echo $row["gpt_response"];
        
        
        echo "<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>";
        echo $row["gpt_response_1"];
        echo "<br>";
        echo $row["gpt_response_6"];
        echo "<br>";
        echo $row["gpt_response_7"];
        echo "<br>";
        echo $row["gpt_response_8"];
        echo "<br>";
        echo $row["gpt_response_9"];
        echo "<br><br><br>"; // Added for separation between rows
    }
} else {
    echo "No results found or there was an error executing the SQL query.";
}

$conn->close();

?>

