mysql - php script only display one row of data instead of many in android studio -
i ask how can display many row
s of data instead of 1 row
. following code display 1 row of record instead of multiple records available. i'm using mysqli_prepare
statements here. or problem on android studio coding? application implemented login function , coding below.
<?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 discipline_record left join student_list on discipline_record.studic = student_list.studic left join parents_data on student_list.parentic = parents_data.parentic parents_data.parentic = ? , 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); ?>
i go that:
$usergroup = array(); $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; array_push($usergroup,$user); } echo json_encode($usergroup);
Comments
Post a Comment