コード例 #1
0
ファイル: deleteRecord.php プロジェクト: jpj/Your-Car-s-Life
//error_log("\$logRecordId is $logRecordId ");
// If user is not logged in then create an error.
// Do not bother validating the other fields if not logged in.
if ($user->getIsLoggedIn()) {
    if (!$logRecordId) {
        $status = "fail";
        $errors[logRecordId] = "No logRecordId specefied.";
    }
} else {
    $status = "fail";
    $errors[user] = "You are not logged in.";
}
$logRec = new LogRecord();
if ($status == "success") {
    // Everything is OK. Do the DELETE:
    $logRec->setId($logRecordId);
    if (!$logRec->deleteRecord()) {
        $status = "fail";
        $errors[deleteRecordFailed] = "Failed to delete record.";
    }
}
header("content-type: text/xml");
?>


<DeleteLogRecord>
	<logId><?php 
echo $logRec->getId();
?>
</logId>
	<status><?php 
コード例 #2
0
ファイル: getRecords.php プロジェクト: jpj/Your-Car-s-Life
    $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 AND LOG_ID IN ('%s', '%s')", mysql_real_escape_string($user->getUserId(), $conn), mysql_real_escape_string($user->getCurrentAutoId(), $conn), mysql_real_escape_string($previousLogRecordId, $conn), mysql_real_escape_string($logRecordId, $conn));
} else {
    $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));
}
/*
$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();