2012-04-21 1 views
2

내 융합 테이블에 공개 데이터를 삽입하고 싶습니다. 나는 구체적으로 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> 

답변

0

내가이 테이블에 권한 문제라고 생각한다. 로그인하는 계정이이 테이블의 편집기로 설정되었는지 확인 했습니까? 이것을 확인하는 가장 쉬운 방법은 테이블의 소유자 인 퓨전 테이블로 이동 한 다음 오른쪽 상단 모서리에있는 공유 링크를 클릭하는 것입니다.