我的PHP代碼是windows phone7,我想通過使用PHP頁面發佈我的數據。
<?php
$id = $_GET['id'];
define("__ZBXE__", true);
include("../../files/config/db.config.php");
$connect = @mysql_connect(localhost, kah601, kah909090);
@mysql_select_db("kah601", $connect);
@mysql_query("set names utf8");
$name = $_POST['name'];
$name = $_POST['ox_score'];
$name = $_POST['between_score'];
$name = $_POST['order_score'];
$name = $_POST['total_score'];
$sql = sprintf("INSERT INTO `jp_mango` (`name`, `ox_score`, `between_score`, `order_score`, `total_score`) VALUES ('%s', '%s', '%s', '%s' , '%s');",$name, $ox_score, $between_score, $order_score, $total_score);
$result = mysql_query($sql, $connect);
mysql_close();
?>
我要上傳5個數據(姓名,ox_score,between_score,order_score,total_score)。
我從堆棧溢出引用此代碼。 但我無法發佈數據。 當我看到加載頁面時,顯示爲這樣。 (數字自動遞增)
"num":"8","name":"","ox_score":"","between_score":"","order_score":"","total_score":""
我該如何發佈此類數據? 請幫我一把。
string sendData = "";
Uri site = new Uri("http://kah601.cafe24.com/jp_mango_writeboard.php");
WebClient wc = new WebClient();
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
sendData += "name=hello";
sendData += "ox_score=10";
sendData += "between_score=10";
sendData += "order_score=10";
sendData += "total_score=30";
wc.Headers[HttpRequestHeader.ContentLength] = sendData.Length.ToString();
wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wc_UploadStringCompleted);
//wc.UploadStringAsync(site, "POST", post_name, "name");
wc.UploadStringAsync(site, "POST", sendData);
omg愚蠢的錯誤..........非常感謝。 –
@CindyKim你有解決方案嗎? – StaticVariable
uhm。還沒。在第一次,我改變了我的PHP代碼。 $ name = $ _POST ['name']; $ ox_score = $ _POST ['ox_score']; ... 喜歡這個。但它只發布名稱。然後我改變了你的代碼。 ($ name = $ newdata-> name; $ ox_score = $ newdara-> ox_score; ...)但它沒有發表任何內容。我是一個PHP,WP7初學者。 : - <........ –