1
這是獲取Twitter主頁小碼是新手,現在誰能告訴我如何將這些數據存儲在SQL數據庫中。 thxs
<head>
<title>twitter example</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(function()
{
$('#btn').click(function()
{
twitterusername = $('#uname').val();
if(twitterusername != '')
{
$('#loading').text('Please wait...');
$.getJSON('http://twitter.com/users/'+twitterusername+'.json?callback=?',
function(data)
{
$('#loading').empty();
$('#twit_uname').html('<b>'+data.screen_name+'</b>');
$('#twit_frnd').html('<b>'+data.friends_count+'</b>');
$('#twit_name').html('<b>'+data.name+'</b>');
$('#twit_flwr').html('<b>'+data.followers_count+'</b>');
$('#twit_img').html('<img src="'+data.profile_image_url+'" height="50" width="50">');
});
}
});
})
</script>
<style>
div{float:right; border-bottom:1px dashed #909; margin-bottom:2px;}
li{border-bottom:1px dashed #909; margin-bottom:10px;}
.main{margin:auto;border:1px solid #CC0;float:none;width:1000px;padding:10px;font-family:Verdana, Geneva, sans-serif;font-size:16px;color:#000000;}
b{float:left; text-align:left;}
</style>
</head>
</style>
<body>
<?php include "../header.php"; ?>
<div class="main">
Enter your Twitter Username : <input type="text" name="user" id="uname">
<input type="button" value="Get my Profile" id="btn"><br />
<div id="loading" align="center"></div>
<ul>
<li>Name : <div id="twit_name"></div></li>
<li>Username : <div id="twit_uname"></div></li>
<li>Followers : <div id="twit_flwr"></div></li>
<li>Following : <div id="twit_frnd"></div></li>
<li>Profile Image : <div id="twit_img" style="border:1px solid #999999; height:50; width:50;"></div></li>
<input type="button" value="Save to Database" id="btn1">
</ul>
</div>
</body>
</html>
您正在使用哪個SQL數據庫?你有沒有設置數據庫表?你有任何代碼嗎?你以前使用過SQL嗎? – Prisoner 2011-02-10 11:39:14
@Prisoner,什麼都沒有指定,代碼是在PHP中,把它作爲MySQL :) – shamittomar 2011-02-10 11:41:16