Here is the rest of my code:
<?php
require __DIR__ . '/include/credentials.php';
// Retrieve Morning Dollar Amount Record Data
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
echo "Error: If problem persists please contact [email protected] - 5000\n";
$content = "Error: . $conn->connect_error . -5000\n";
file_put_contents('main_log.txt', $content);
$sql = "SELECT date_da, team_da, dollar_amount FROM morning_da";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$dateb_da = $row["date_da"];
$teamb_da = $row["team_da"];
$damountb = $row["dollar_amount"];
}
}
else {
echo "Error Retrieving Data/No Data Found in morning dollar amount table, if problem persists please contact [email protected]\n";
}
$conn->close();
// Retrieve Morning Car Count Record Data
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
echo "Error: If problem persists please contact [email protected] - 5100\n";
$content = "Error: . $conn->connect_error . -5100\n";
file_put_contents('main_log.txt', $content);
$sql = "SELECT date_cc, team_cc, car_count FROM morning_cc";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$dateb_cc = $row["date_cc"];
$teamb_cc = $row["team_cc"];
$ccountb = $row["car_count"];
}
}
else {
echo "Error Retrieving Data/No Data Found in morning dollar amount table, if problem persists please contact [email protected]\n";
}
$conn->close();
// Retrieve Lunch Dollar Amount Record Data
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
echo "Error: If problem persists please contact [email protected] - 5200\n";
$content = "Error: . $conn->connect_error . -5200\n";
file_put_contents('main_log.txt', $content);
$sql = "SELECT date_da, team_da, dollar_amount FROM lunch_da";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$datel_da = $row["date_da"];
$teaml_da = $row["team_da"];
$damountl = $row["dollar_amount"];
}
}
else {
echo "Error Retrieving Data/No Data Found in lunch table, if problem persists please contact [email protected]\n";
}
$conn->close();
// Retrieve Lunch Car Count Record Data
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
echo "Error: If problem persists please contact [email protected] - 5300\n";
$content = "Error: . $conn->connect_error . -5300\n";
file_put_contents('main_log.txt', $content);
$sql = "SELECT date_cc, team_cc, car_count FROM lunch_cc";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$datel_cc = $row["date_cc"];
$teaml_cc = $row["team_cc"];
$ccountl = $row["car_count"];
}
}
else {
echo "Error Retrieving Data/No Data Found in lunch table, if problem persists please contact [email protected]\n";
}
$conn->close();
// Retrieve Dinner Dollar Amount Record Data
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
echo "Error: If problem persists please contact [email protected] - 5400\n";
$content = "Error: . $conn->connect_error . -5400\n";
file_put_contents('main_log.txt', $content);
$sql = "SELECT date_da, team_da, dollar_amount FROM dinner_da";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$dated_da = $row["date_da"];
$teamd_da = $row["team_da"];
$damountd = $row["dollar_amount"];
}
}
else {
echo "Error Retrieving Data/No Data Found in dinner table, if problem persists please contact [email protected]\n";
}
$conn->close();
// Retrieve Dinner Car Count Record Data
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
echo "Error: If problem persists please contact [email protected] - 5500\n";
$content = "Error: . $conn->connect_error . -5500\n";
file_put_contents('main_log.txt', $content);
$sql = "SELECT date_cc, team_cc, car_count FROM dinner_cc";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$dated_cc = $row["date_cc"];
$teamd_cc = $row["team_cc"];
$ccountd = $row["car_count"];
}
}
else {
echo "Error Retrieving Data/No Data Found in dinner table, if problem persists please contact [email protected]\n";
}
$conn->close();
// Retrieve Monthly Morning Dollar Amount Record Data
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
echo "Error: If problem persists please contact [email protected] - 5600\n";
$content = "Error: . $conn->connect_error . -5600\n";
file_put_contents('main_log.txt', $content);
$sql = "SELECT date_da, team_da, dollar_amount FROM monthly_morning_da";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$mdateb_da = $row["date_da"];
$mteamb_da = $row["team_da"];
$mdamountb = $row["dollar_amount"];
}
}
else {
echo "Error Retrieving Data/No Data Found in monthly morning table, if problem persists please contact [email protected]\n";
}
$conn->close();
// Retrieve Monthly Morning Car Count Record Data
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
echo "Error: If problem persists please contact [email protected] - 5700\n";
$content = "Error: . $conn->connect_error . -5700\n";
file_put_contents('main_log.txt', $content);
$sql = "SELECT date_cc, team_cc, car_count FROM monthly_morning_cc";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$mdateb_cc = $row["date_cc"];
$mteamb_cc = $row["team_cc"];
$mccountb = $row["car_count"];
}
}
else {
echo "Error Retrieving Data/No Data Found in monthly morning table, if problem persists please contact [email protected]\n";
}
$conn->close();
// Retrieve Monthly Lunch Dollar Amount Record Data
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
echo "Error: If problem persists please contact [email protected] - 5800\n";
$content = "Error: . $conn->connect_error . -5800\n";
file_put_contents('main_log.txt', $content);
$sql = "SELECT date_da, team_da, dollar_amount FROM monthly_lunch_da";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$mdatel_da = $row["date_da"];
$mteaml_da = $row["team_da"];
$mdamountl = $row["dollar_amount"];
}
}
else {
echo "Error Retrieving Data/No Data Found in monthly lunch table, if problem persists please contact [email protected]\n";
}
$conn->close();
// Retrieve Monthly Lunch Car Count Record Data
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
echo "Error: If problem persists please contact [email protected] - 5900\n";
$content = "Error: . $conn->connect_error . -5900\n";
file_put_contents('main_log.txt', $content);
$sql = "SELECT date_cc, team_cc, car_count FROM monthly_lunch_cc";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$mdatel_da = $row["date_cc"];
$mteaml_da = $row["team_cc"];
$mccountl = $row["car_count"];
}
}
else {
echo "Error Retrieving Data/No Data Found in monthly lunch table, if problem persists please contact [email protected]\n";
}
$conn->close();
// Retrieve Monthly Dinner Dollar Amount Record Data
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
echo "Error: If problem persists please contact [email protected] - 6000\n";
$content = "Error: . $conn->connect_error . -6000\n";
file_put_contents('main_log.txt', $content);
}
$sql = "SELECT date_da, team_da, dollar_amount FROM monthly_dinner_da";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$mdated_da = $row["date_da"];
$mteamd_da = $row["team_da"];
$mdamountd = $row["dollar_amount"];
}
}
else {
echo "Error Retrieving Data/No Data Found in monthly dinner table, if problem persists please contact [email protected]\n";
}
$conn->close();
// Retrieve Monthly Dinner Car Count Record Data
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
echo "Error: If problem persists please contact [email protected] - 6100\n";
$content = "Error: . $conn->connect_error . -6100\n";
file_put_contents('main_log.txt', $content);
}
$sql = "SELECT date_cc, team_cc, car_count FROM monthly_dinner_cc";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$mdated_cc = $row["date_cc"];
$mteamd_cc = $row["team_cc"];
$mccountd = $row["car_count"];
}
}
else {
echo "Error Retrieving Data/No Data Found in monthly dinner table, if problem persists please contact [email protected]\n";
}
$conn->close();
?>
I am sure there is a better way to do this, but this is my first project, so I am learning as I am building, error logging is my next thing I am redoing.
Also, even though the error says it’s on line 700, my PHP only goes to line 300. When I tested just the PHP it gave me the same error just at the new end. I’m guessing that I am missing something big, but I honestly don’t know what I am looking for.