function echoXMLFile() { /* File Location To Read */ include 'xmlGeneratorConfig.php'; /*output type is xml*/ header('Content-Type: text/xml'); //create the file if it doesn't exist if (file_exists($XML_FILENAME) == false) { reuse_generateXML(); if (file_exists($XML_FILENAME) == false) { // if the file still doesn't exist, there are problems echo "{$XML_FILENAME} Does not Exist. Check the configuration of XML Generator"; } } echo file_get_contents($XML_FILENAME); return; }
echo "Prepare failed : (" . $mysqli->connect_errno . ")" . $mysqli->connect_error; } /* bind the variables */ if (!$stmt->bind_param('ssssiissdd', $name, $address, $address2, $city, $stateId, $zipcode, $phone, $website, $latitude, $longitude)) { echo "Binding failed. (" . $mysqli->connect_errno . ")" . $mysqli->connect_error; } /* execute */ if (!$stmt->execute()) { echo "Execute failed. (" . $mysqli->connect_errno . ")" . $mysqli->connect_error; } /* updated */ echo 1; $stmt->close(); $mysqli->close(); /* Update Mobile Database */ reuse_generateXML(); }); /* Adding a New Category */ $app->post('/category', function () { $name = $_POST['name']; $mysqli = connectReuseDB(); /* Check to make sure it's not a duplicate */ $result = $mysqli->query('SELECT name, id FROM Reuse_Categories'); while ($row = $result->fetch_object()) { if ($row->name == $name) { $mysqli->close(); } } /* prepare the statement*/ if (!($stmt = $mysqli->prepare("INSERT INTO Reuse_Categories (name) VALUES (?)"))) { echo "Prepare failed : (" . $mysqli->connect_errno . ")" . $mysqli->connect_error;