0

i have invested much more time in simple query ,i was trying to select different rows of same standard_id and in my database is two such rows which have same standard_id but from them i only getting first row of same standard_id and while second row is missing ,i don't know what's i doing wrong , can anyone check please. your any help would be very helpful.

my sql query code:

   <?php 
require_once("../header.php");
include_once("adminTitlebar.php");
error_reporting(E_ALL); 
ini_set('display_errors', 1);
 if(isset($_POST['search'])){
    $standard= $_POST['Standard'];
    $student_name= $_POST['student'];
    $sql="SELECT * FROM `student_details` WHERE `st_standard`=2";

    $result=mysqli_query($con,$sql);
    $rows=mysqli_fetch_assoc($result);
    print_r($rows);
    die;
    $new_array=array();
    array_push($new_array,$rows);
 }
 else{
    //die("failed to search data due to :".mysqli_error());
}
?>

and stored record of my database is:

enter image description here

can only tell me the problems is it in my code or the problems have in database?

5
  • Where is the code that's only getting a single row? And is there a reason you're not using a $wpdb query? – WebElaine Jan 8 '20 at 20:21
  • no reason but i am trying to fetch the data by core php – Tahridabbas Jan 8 '20 at 20:33
  • i am updating the code now please check – Tahridabbas Jan 8 '20 at 20:33
  • This is core PHP code run against a non-WordPress database table. The WordPress stack is not the right place to be asking this question, It belongs on stackoverflow.com – Jacob Peattie Jan 9 '20 at 0:39
  • OK i understand it..whoever i asked to get any help or guide – Tahridabbas Jan 9 '20 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.