row
を1つではなくrow
と多く表示するにはどうすればいいですか?次のコードは、複数のレコードが利用可能ではなく、レコードの1行のみを表示します。私はここにmysqli_prepare
ステートメントを使用しています。または、問題は私のアンドロイドスタジオコーディングにありますか?私のアプリケーションは以下のようにログイン機能とコーディングで実装されています。PHPスクリプトでは、アンドロイドスタジオではなく、1行のデータしか表示されません
<?php
$host="DB_HOST";
$user="DB_USER";
$password="DB_PASSWORD";
$db="DB_NAME";
$con = mysqli_connect($host,$user,$password,$db);
$parentic=$_POST["ParentIC"];
$password=$_POST["Password"];
$selectquery = mysqli_prepare($con, "SELECT Parents_Data.Name, Student_List.StudName, Student_List.StudIC, Student_List.Form,Student_List.Class,discipline_record.Date,discipline_record.RulesCode, discipline_record.TypesofMistakes,discipline_record.Punishment FROM discipline_record LEFT JOIN Student_List ON discipline_record.StudIC = Student_List.StudIC LEFT JOIN Parents_Data ON Student_List.ParentIC = Parents_Data.ParentIC WHERE Parents_Data.ParentIC = ? AND Parents_Data.Password = ? ");
mysqli_stmt_bind_param ($selectquery, "ss", $parentic, $password);
mysqli_stmt_execute($selectquery);
mysqli_stmt_store_result($selectquery);
mysqli_stmt_bind_result($selectquery,$name,$studname,$studic,$form,$classs,$ddate,$code,$mistakes,$punishment);
$user = array();
while(mysqli_stmt_fetch($selectquery))
{
$user[name]=$name;
$user[studname]=$studname;
$user[studic] = $studic;
$user[form]=$form;
$user[classs]=$classs;
$user[ddate]=$ddate;
$user[code]=$code;
$user[mistakes]=$mistakes;
$user[punishment]=$punishment;
}
echo json_encode($user);
mysqli_stmt_close($selectquery);
mysqli_close($con);
?>
'foreach'ループを使用して、やり直してくださいを。 –
@ChoncholMahmudはもっと私を導くことができますか?私はこれに新しいですから。おかげでwhileループ内での助けを –
残念ながら、それは、変更を加えるdoesntの..助けを – RST