我試圖從多個表中的多個列中獲取值。代碼如下所示:數據庫賦值兩次
<?php
$connect = mysql_connect("localhost","en","]9");
mysql_select_db("en");
$result = mysql_query("SELECT title, field_id_1 FROM exp_channel_titles, exp_channel_data") or die(mysql_error());
// check for empty result
if (mysql_num_rows($result) > 0) {
// looping through all results
// products node
$response["video_path"] = array();
while ($row = mysql_fetch_array($result)) {
// temp user array
$s1 = explode('"',$row['field_id_1']);
$path = array();
$path["field_id_1"] = $s1[5];
$path["title"] = $row["title"];
array_push($response["video_path"], $path);
}
// success
$response["success"] = 1;
// echoing JSON response
echo json_encode($response);
} else {
// no products found
$response["success"] = 0;
$response["message"] = "No products found";
// echo no users JSON
echo json_encode($response);
}
?>
在結果中,值顯示兩次而不是一次。我檢查了兩個表,但這兩個表確實包含同名的列。
現在更改密碼。 – Strawberry 2013-05-01 11:08:36
你需要訪問服務器嗎?發佈前我更改了密碼和數據庫名稱。 – user2064667 2013-05-01 11:15:31
好 - 只需檢查;-) – Strawberry 2013-05-01 11:35:22