Example #1
0
        $isErrors = "true";
        $errors[logRecordDipstick] = "Dipstick reading must be a numeric value. You entered \"{$logRecordDipstick}\"";
    }
} else {
    $isErrors = "true";
    $errors[user] = "You are not logged in.";
}
$logRec = new LogRecord();
if ($isErrors != "true") {
    // Everything is OK. Do the INSERT:
    $logRec->setId($logRecordId);
    $logRec->setAutoId($user->getCurrentAutoId());
    $logRec->setUserId($user->getUserId());
    $logRec->setLogDate($logRecordDate);
    $logRec->setOdometer($logRecordOdometer);
    $logRec->setGallons($logRecordGallons);
    $logRec->setOctane($logRecordOctane);
    $logRec->setDipstick($logRecordDipstick);
    $logRec->writeRecord();
}
header("content-type: text/xml");
?>


<SaveLogRecord>
	<logId><?php 
echo $logRec->getId();
?>
</logId>
	<previousRecordId><?php 
echo $logRec->getPreviousRecord();
Example #2
0
    if ($_POST["octane"] < 87 || $_POST["octane"] > 94) {
        $errors = "true";
        $errOctane = "The only supported octanes are 87 - 94.";
    }
} else {
    $errors = "true";
    $errLogin = "******";
}
if ($errors != "true") {
    // Everything is OK. Do the INSERT:
    $logRec = new LogRecord();
    $logRec->setAutoId($user->getCurrentAutoId());
    $logRec->setUserId($user->getUserId());
    $logRec->setLogDate($_POST["date"]);
    $logRec->setOdometer($_POST["odometer"]);
    $logRec->setGallons($_POST["gallons"]);
    $logRec->setOctane($_POST["octane"]);
    $logRecordId = $logRec->writeRecord();
}
header("content-type: text/xml");
?>


<AddRecordErrors>
	<errors><?php 
echo $errors;
?>
</errors>
	<login><?php 
echo $errLogin;
?>
Example #3
0
/*
$query = sprintf("SELECT DATE_FORMAT(LOG_DATE, '%%Y-%%m-%%d %%H:%%i') AS LOG_DATE_FORMAT, L.* FROM LOG L WHERE L.USER_ID='%s' AND L.AUTO_ID='%s' AND ACTIVE=1 ORDER BY L.ODOMETER LIMIT $maxRows OFFSET %s",
	mysql_real_escape_string($user->getUserId(), $conn),
	mysql_real_escape_string($user->getCurrentAutoId(), $conn),
	mysql_real_escape_string($totalRows - $maxRows, $conn)
);
*/
$resultSet = mysql_query($query);
//error_log($query);
while ($row = mysql_fetch_array($resultSet, MYSQL_ASSOC)) {
    $logRec = new LogRecord();
    $logRec->setId($row["LOG_ID"]);
    $logRec->setAutoId($row["AUTO_ID"]);
    $logRec->setLogDate($row["LOG_DATE_FORMAT"]);
    $logRec->setOdometer($row["ODOMETER"]);
    $logRec->setGallons($row["GALLONS"]);
    $logRec->setOctane($row["OCTANE"]);
    $logRec->setDipstick($row["DIPSTICK"]);
    ?>

	<record>
		<id><?php 
    echo $logRec->getId();
    ?>
</id>
		<date><?php 
    echo $logRec->getLogDate();
    ?>
</date>
		<odometer><?php 
    echo $logRec->getOdometer();