내 융합 테이블에 공개 데이터를 삽입하고 싶습니다. 나는 구체적으로 https://developers.google.com/fusiontables/docs/sample_code에 도움을 청했는데, http://code.google.com/p/fusion-tables-client-php/source/browse/trunk/samples/form_example.php. 이 스크립트의 실행에 필요한 파일 (다운로드 한 clienlogin.php, file.php, sql.php 및 constants.php)을 다운로드했습니다. 스크립트가 실행 중이지만 행이 삽입되지 않고 이유를 찾을 수 없습니다. 나는 내 코드를 붙여 넣었다. (작은 코드는 그것을 보라. 내가 커밋하는 오류를 알려주기 바란다.) 기본적으로 사용자 양식을 통해 사용자 정보를 수집 한 후 융합 테이블에 데이터를 삽입하려고합니다. 나는 Google 양식을 사용하고 싶지 않습니다. 이 방향으로 어떤 종류의 도움/포인터가 도움이 될 것입니다.Google 융합 테이블에 삽입
<html>
<?php
include('D:\xampp\htdocs\itpold\clientlogin.php');
include('D:\xampp\htdocs\itpold\sql.php');
include('D:\xampp\htdocs\itpold\file.php');
// Table id
$tableid = 3544282;
//Enter your username and password
$username = "[email protected]";
$password = "XYZ";
$token = ClientLogin::getAuthToken($username, $password);
$ftclient = new FTClientLogin($token);
// If the request is a post, insert the data into the table
if($_SERVER['REQUEST_METHOD'] == 'POST') {
// Insert form data into table
$insertresults = $ftclient->query(SQLBuilder::insert($tableid,
array('Name'=> $_POST['Name'],
'Location' => $_POST['Location'])));
$insertresults = explode("\n", $insertresults);
$rowid1 = $insertresults[1];
echo $rowid1 ;
}
?>
<head>
<title>Simple Form Example</title>
<style>
body { font-family: Arial, sans-serif; }
</style>
<script type="text/javascript">
// Simple form checking.
function check_form() {
if(document.getElementById('Name').value == '' ||
document.getElementById('Location').value == '') {
alert('Name and location required.');
return false;
}
return true;
}
</script>
</head>
<body >
<h1>Simple Form Example</h1>
<h2>Insert data</h2>
<form method="post" action="forms.php" onsubmit="return check_form();">
Name: <input type="text" name="Name" id="Name" /><br />
Result: <input type="text" name="Location" id="Location" /><br />
<input type="submit" value="Submit" />
</form>
<h2>Table data</h2>
<p>
<?php
// Show the data from table
$table_data = $ftclient->query(SQLBuilder::select($tableid));
$table_data = explode("\n", $table_data);
for($i = 0; $i < count($table_data); $i++) {
echo $table_data[$i] . '<br />';
}
?>
</p>
</body>
</html>