私は少し問題があります.以前はJOINを使用したことがありません.これは初めてであり、いくつかの問題に遭遇しました:
<?php
//$count to keep the counter go from 0 to new value
$count=0;
//I need to select the level for the users building first, meanwhile i also
//need to get the money_gain from the table buildings, which is a table that
//is common for each member, which means it doesnt have a userid as the other table!
//And then for each of the buildings there will be a $counting
$qu1 = mysql_query("SELECT building_user.level,buildings.money_gain FROM building_user,buildings WHERE building_user.userid=$user");
while($row = mysql_fetch_assoc($qu1))
{
$count=$count+$row['level'];
echo $row['level'];
}
?>
基本的には、共通の列でそれらを結び付ける必要があると聞いたことがありますが、この場合、それらはありません..私は今迷っていますか?
編集 そうですね、正しい money_gain で取り出すには適切なレベルが必要です。Building_user では「BuildingID」、建物では「ID」だけです! ただし、一般的なステートメントを作成する方法がわかりません!