PHP function Array Returning One records many times











up vote
1
down vote

favorite












I have My code Below. I have a function "getdet" that return array of record,but i cant able to print the all records the codes displaying only the first records may time. Pls help to solve this issue.



<?php

function getdet($qry){
global $con;
$Selecting=mysqli_query($con,$qry);
$Fetch=mysqli_fetch_array($Selecting);
return $Fetch;
}
$qry="SELECT * FROM `tbs_employee` WHERE EmpId='1' limit 1";
$GetData=getdet($qry);
$i=0;
while($GetData){
echo $i."-".$GetData['EmpId'].":".$GetData['EmpName']."<br>";
$i++;
}
?>


Below is my Table



enter image description here



Here is my result



0-1:Fst Employee
1-1:Fst Employee
2-1:Fst Employee
3-1:Fst Employee
4-1:Fst Employee
5-1:Fst Employee
6-1:Fst Employee
.
.
.
infinity









share|improve this question




























    up vote
    1
    down vote

    favorite












    I have My code Below. I have a function "getdet" that return array of record,but i cant able to print the all records the codes displaying only the first records may time. Pls help to solve this issue.



    <?php

    function getdet($qry){
    global $con;
    $Selecting=mysqli_query($con,$qry);
    $Fetch=mysqli_fetch_array($Selecting);
    return $Fetch;
    }
    $qry="SELECT * FROM `tbs_employee` WHERE EmpId='1' limit 1";
    $GetData=getdet($qry);
    $i=0;
    while($GetData){
    echo $i."-".$GetData['EmpId'].":".$GetData['EmpName']."<br>";
    $i++;
    }
    ?>


    Below is my Table



    enter image description here



    Here is my result



    0-1:Fst Employee
    1-1:Fst Employee
    2-1:Fst Employee
    3-1:Fst Employee
    4-1:Fst Employee
    5-1:Fst Employee
    6-1:Fst Employee
    .
    .
    .
    infinity









    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have My code Below. I have a function "getdet" that return array of record,but i cant able to print the all records the codes displaying only the first records may time. Pls help to solve this issue.



      <?php

      function getdet($qry){
      global $con;
      $Selecting=mysqli_query($con,$qry);
      $Fetch=mysqli_fetch_array($Selecting);
      return $Fetch;
      }
      $qry="SELECT * FROM `tbs_employee` WHERE EmpId='1' limit 1";
      $GetData=getdet($qry);
      $i=0;
      while($GetData){
      echo $i."-".$GetData['EmpId'].":".$GetData['EmpName']."<br>";
      $i++;
      }
      ?>


      Below is my Table



      enter image description here



      Here is my result



      0-1:Fst Employee
      1-1:Fst Employee
      2-1:Fst Employee
      3-1:Fst Employee
      4-1:Fst Employee
      5-1:Fst Employee
      6-1:Fst Employee
      .
      .
      .
      infinity









      share|improve this question















      I have My code Below. I have a function "getdet" that return array of record,but i cant able to print the all records the codes displaying only the first records may time. Pls help to solve this issue.



      <?php

      function getdet($qry){
      global $con;
      $Selecting=mysqli_query($con,$qry);
      $Fetch=mysqli_fetch_array($Selecting);
      return $Fetch;
      }
      $qry="SELECT * FROM `tbs_employee` WHERE EmpId='1' limit 1";
      $GetData=getdet($qry);
      $i=0;
      while($GetData){
      echo $i."-".$GetData['EmpId'].":".$GetData['EmpName']."<br>";
      $i++;
      }
      ?>


      Below is my Table



      enter image description here



      Here is my result



      0-1:Fst Employee
      1-1:Fst Employee
      2-1:Fst Employee
      3-1:Fst Employee
      4-1:Fst Employee
      5-1:Fst Employee
      6-1:Fst Employee
      .
      .
      .
      infinity






      php mysql






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 19 at 9:19









      Sanu0786

      517113




      517113










      asked Nov 19 at 9:17









      Brindha Baskaran

      929




      929
























          3 Answers
          3






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          Well, your function only return a data. Here's the right way:



          <?php
          function getdet($qry){
          global $con;
          $Selecting=mysqli_query($con,$qry);
          while($row=mysqli_fetch_array($Selecting, MYSQLI_ASSOC)){
          $Fetch = $row;
          }
          return $Fetch;
          }
          $qry="SELECT * FROM `tbs_employee`";
          $GetData=getdet($qry);
          foreach($GetData as $i=>$row){
          echo $i."-".$row['EmpId'].":".$row['EmpName']."<br/>";
          }
          ?>





          share|improve this answer























          • Works fine thank you
            – Brindha Baskaran
            Nov 19 at 10:03










          • You're welcome :)
            – Rahmad
            Nov 19 at 10:06


















          up vote
          1
          down vote













          You are running the same query ($Selecting=mysqli_query($con,$qry);) over and over again inside your getDet-Function, so it will never quit the while-loop:



          while($GetData){


          Should be:



          $qry="SELECT * FROM `tbs_employee` WHERE EmpId='1' limit 1";
          $Selecting=mysqli_query($con,$qry);
          $i=0;
          while($GetData = mysqli_fetch_array($Selecting)){
          echo $i."-".$GetData['EmpId'].":".$GetData['EmpName']."<br>";
          $i++;
          }


          mysqli_fetch_array will return null, if all results are returned, then the while-loop can exit.






          share|improve this answer





















          • He needs to get all records, there's problem in sql-query
            – Oleg Nurutdinov
            Nov 19 at 9:27










          • Sorry, and in the loop too)
            – Oleg Nurutdinov
            Nov 19 at 9:29










          • @OlegNurutdinov he's not getting all results, because he always runs the query again, after the first row is processed, leading to an infinite amount of "first rows" for the final result. (Despite his query is limiting the result to one row exactly)
            – dognose
            Nov 19 at 9:30












          • Of course, I did not notice at loop first time.
            – Oleg Nurutdinov
            Nov 19 at 9:43










          • @dognose thanks for your answer. but I don't want to repeat the mysql_query(),mysqli_fetch_array() functions, I need a function to pass a query and return the result as an array. I just want to reduce my lines of code
            – Brindha Baskaran
            Nov 19 at 9:58


















          up vote
          0
          down vote













          In your query you filtered employers by the ID
          WHERE EmpId='1' limit 1



          If you wants to get all records, delete this statement.






          share|improve this answer























          • Changed to $qry="SELECT * FROM tbs_employee WHERE EmpId='1' "; but same result
            – Brindha Baskaran
            Nov 19 at 9:20










          • delete WHERE EmpId='1' statement as I advice you in answer
            – Oleg Nurutdinov
            Nov 19 at 9:21










          • you query sholud be "SELECT * FROM tbs_employee"
            – Oleg Nurutdinov
            Nov 19 at 9:22










          • tried $qry="SELECT * FROM tbs_employee WHERE 1 "; but the result is 0-2:test Employee 1-2:test Employee 2-2:test Employee 3-2:test Employee 4-2:test Employee 5-2:test Employee 6-2:test Employee 7-2:test Employee
            – Brindha Baskaran
            Nov 19 at 9:23












          • @BrindhaBaskaran you query sholud be "SELECT * FROM tbs_employee"
            – Oleg Nurutdinov
            Nov 19 at 9:25











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371484%2fphp-function-array-returning-one-records-many-times%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote



          accepted










          Well, your function only return a data. Here's the right way:



          <?php
          function getdet($qry){
          global $con;
          $Selecting=mysqli_query($con,$qry);
          while($row=mysqli_fetch_array($Selecting, MYSQLI_ASSOC)){
          $Fetch = $row;
          }
          return $Fetch;
          }
          $qry="SELECT * FROM `tbs_employee`";
          $GetData=getdet($qry);
          foreach($GetData as $i=>$row){
          echo $i."-".$row['EmpId'].":".$row['EmpName']."<br/>";
          }
          ?>





          share|improve this answer























          • Works fine thank you
            – Brindha Baskaran
            Nov 19 at 10:03










          • You're welcome :)
            – Rahmad
            Nov 19 at 10:06















          up vote
          0
          down vote



          accepted










          Well, your function only return a data. Here's the right way:



          <?php
          function getdet($qry){
          global $con;
          $Selecting=mysqli_query($con,$qry);
          while($row=mysqli_fetch_array($Selecting, MYSQLI_ASSOC)){
          $Fetch = $row;
          }
          return $Fetch;
          }
          $qry="SELECT * FROM `tbs_employee`";
          $GetData=getdet($qry);
          foreach($GetData as $i=>$row){
          echo $i."-".$row['EmpId'].":".$row['EmpName']."<br/>";
          }
          ?>





          share|improve this answer























          • Works fine thank you
            – Brindha Baskaran
            Nov 19 at 10:03










          • You're welcome :)
            – Rahmad
            Nov 19 at 10:06













          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted






          Well, your function only return a data. Here's the right way:



          <?php
          function getdet($qry){
          global $con;
          $Selecting=mysqli_query($con,$qry);
          while($row=mysqli_fetch_array($Selecting, MYSQLI_ASSOC)){
          $Fetch = $row;
          }
          return $Fetch;
          }
          $qry="SELECT * FROM `tbs_employee`";
          $GetData=getdet($qry);
          foreach($GetData as $i=>$row){
          echo $i."-".$row['EmpId'].":".$row['EmpName']."<br/>";
          }
          ?>





          share|improve this answer














          Well, your function only return a data. Here's the right way:



          <?php
          function getdet($qry){
          global $con;
          $Selecting=mysqli_query($con,$qry);
          while($row=mysqli_fetch_array($Selecting, MYSQLI_ASSOC)){
          $Fetch = $row;
          }
          return $Fetch;
          }
          $qry="SELECT * FROM `tbs_employee`";
          $GetData=getdet($qry);
          foreach($GetData as $i=>$row){
          echo $i."-".$row['EmpId'].":".$row['EmpName']."<br/>";
          }
          ?>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 19 at 10:02

























          answered Nov 19 at 9:56









          Rahmad

          413




          413












          • Works fine thank you
            – Brindha Baskaran
            Nov 19 at 10:03










          • You're welcome :)
            – Rahmad
            Nov 19 at 10:06


















          • Works fine thank you
            – Brindha Baskaran
            Nov 19 at 10:03










          • You're welcome :)
            – Rahmad
            Nov 19 at 10:06
















          Works fine thank you
          – Brindha Baskaran
          Nov 19 at 10:03




          Works fine thank you
          – Brindha Baskaran
          Nov 19 at 10:03












          You're welcome :)
          – Rahmad
          Nov 19 at 10:06




          You're welcome :)
          – Rahmad
          Nov 19 at 10:06












          up vote
          1
          down vote













          You are running the same query ($Selecting=mysqli_query($con,$qry);) over and over again inside your getDet-Function, so it will never quit the while-loop:



          while($GetData){


          Should be:



          $qry="SELECT * FROM `tbs_employee` WHERE EmpId='1' limit 1";
          $Selecting=mysqli_query($con,$qry);
          $i=0;
          while($GetData = mysqli_fetch_array($Selecting)){
          echo $i."-".$GetData['EmpId'].":".$GetData['EmpName']."<br>";
          $i++;
          }


          mysqli_fetch_array will return null, if all results are returned, then the while-loop can exit.






          share|improve this answer





















          • He needs to get all records, there's problem in sql-query
            – Oleg Nurutdinov
            Nov 19 at 9:27










          • Sorry, and in the loop too)
            – Oleg Nurutdinov
            Nov 19 at 9:29










          • @OlegNurutdinov he's not getting all results, because he always runs the query again, after the first row is processed, leading to an infinite amount of "first rows" for the final result. (Despite his query is limiting the result to one row exactly)
            – dognose
            Nov 19 at 9:30












          • Of course, I did not notice at loop first time.
            – Oleg Nurutdinov
            Nov 19 at 9:43










          • @dognose thanks for your answer. but I don't want to repeat the mysql_query(),mysqli_fetch_array() functions, I need a function to pass a query and return the result as an array. I just want to reduce my lines of code
            – Brindha Baskaran
            Nov 19 at 9:58















          up vote
          1
          down vote













          You are running the same query ($Selecting=mysqli_query($con,$qry);) over and over again inside your getDet-Function, so it will never quit the while-loop:



          while($GetData){


          Should be:



          $qry="SELECT * FROM `tbs_employee` WHERE EmpId='1' limit 1";
          $Selecting=mysqli_query($con,$qry);
          $i=0;
          while($GetData = mysqli_fetch_array($Selecting)){
          echo $i."-".$GetData['EmpId'].":".$GetData['EmpName']."<br>";
          $i++;
          }


          mysqli_fetch_array will return null, if all results are returned, then the while-loop can exit.






          share|improve this answer





















          • He needs to get all records, there's problem in sql-query
            – Oleg Nurutdinov
            Nov 19 at 9:27










          • Sorry, and in the loop too)
            – Oleg Nurutdinov
            Nov 19 at 9:29










          • @OlegNurutdinov he's not getting all results, because he always runs the query again, after the first row is processed, leading to an infinite amount of "first rows" for the final result. (Despite his query is limiting the result to one row exactly)
            – dognose
            Nov 19 at 9:30












          • Of course, I did not notice at loop first time.
            – Oleg Nurutdinov
            Nov 19 at 9:43










          • @dognose thanks for your answer. but I don't want to repeat the mysql_query(),mysqli_fetch_array() functions, I need a function to pass a query and return the result as an array. I just want to reduce my lines of code
            – Brindha Baskaran
            Nov 19 at 9:58













          up vote
          1
          down vote










          up vote
          1
          down vote









          You are running the same query ($Selecting=mysqli_query($con,$qry);) over and over again inside your getDet-Function, so it will never quit the while-loop:



          while($GetData){


          Should be:



          $qry="SELECT * FROM `tbs_employee` WHERE EmpId='1' limit 1";
          $Selecting=mysqli_query($con,$qry);
          $i=0;
          while($GetData = mysqli_fetch_array($Selecting)){
          echo $i."-".$GetData['EmpId'].":".$GetData['EmpName']."<br>";
          $i++;
          }


          mysqli_fetch_array will return null, if all results are returned, then the while-loop can exit.






          share|improve this answer












          You are running the same query ($Selecting=mysqli_query($con,$qry);) over and over again inside your getDet-Function, so it will never quit the while-loop:



          while($GetData){


          Should be:



          $qry="SELECT * FROM `tbs_employee` WHERE EmpId='1' limit 1";
          $Selecting=mysqli_query($con,$qry);
          $i=0;
          while($GetData = mysqli_fetch_array($Selecting)){
          echo $i."-".$GetData['EmpId'].":".$GetData['EmpName']."<br>";
          $i++;
          }


          mysqli_fetch_array will return null, if all results are returned, then the while-loop can exit.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 19 at 9:23









          dognose

          15.6k64588




          15.6k64588












          • He needs to get all records, there's problem in sql-query
            – Oleg Nurutdinov
            Nov 19 at 9:27










          • Sorry, and in the loop too)
            – Oleg Nurutdinov
            Nov 19 at 9:29










          • @OlegNurutdinov he's not getting all results, because he always runs the query again, after the first row is processed, leading to an infinite amount of "first rows" for the final result. (Despite his query is limiting the result to one row exactly)
            – dognose
            Nov 19 at 9:30












          • Of course, I did not notice at loop first time.
            – Oleg Nurutdinov
            Nov 19 at 9:43










          • @dognose thanks for your answer. but I don't want to repeat the mysql_query(),mysqli_fetch_array() functions, I need a function to pass a query and return the result as an array. I just want to reduce my lines of code
            – Brindha Baskaran
            Nov 19 at 9:58


















          • He needs to get all records, there's problem in sql-query
            – Oleg Nurutdinov
            Nov 19 at 9:27










          • Sorry, and in the loop too)
            – Oleg Nurutdinov
            Nov 19 at 9:29










          • @OlegNurutdinov he's not getting all results, because he always runs the query again, after the first row is processed, leading to an infinite amount of "first rows" for the final result. (Despite his query is limiting the result to one row exactly)
            – dognose
            Nov 19 at 9:30












          • Of course, I did not notice at loop first time.
            – Oleg Nurutdinov
            Nov 19 at 9:43










          • @dognose thanks for your answer. but I don't want to repeat the mysql_query(),mysqli_fetch_array() functions, I need a function to pass a query and return the result as an array. I just want to reduce my lines of code
            – Brindha Baskaran
            Nov 19 at 9:58
















          He needs to get all records, there's problem in sql-query
          – Oleg Nurutdinov
          Nov 19 at 9:27




          He needs to get all records, there's problem in sql-query
          – Oleg Nurutdinov
          Nov 19 at 9:27












          Sorry, and in the loop too)
          – Oleg Nurutdinov
          Nov 19 at 9:29




          Sorry, and in the loop too)
          – Oleg Nurutdinov
          Nov 19 at 9:29












          @OlegNurutdinov he's not getting all results, because he always runs the query again, after the first row is processed, leading to an infinite amount of "first rows" for the final result. (Despite his query is limiting the result to one row exactly)
          – dognose
          Nov 19 at 9:30






          @OlegNurutdinov he's not getting all results, because he always runs the query again, after the first row is processed, leading to an infinite amount of "first rows" for the final result. (Despite his query is limiting the result to one row exactly)
          – dognose
          Nov 19 at 9:30














          Of course, I did not notice at loop first time.
          – Oleg Nurutdinov
          Nov 19 at 9:43




          Of course, I did not notice at loop first time.
          – Oleg Nurutdinov
          Nov 19 at 9:43












          @dognose thanks for your answer. but I don't want to repeat the mysql_query(),mysqli_fetch_array() functions, I need a function to pass a query and return the result as an array. I just want to reduce my lines of code
          – Brindha Baskaran
          Nov 19 at 9:58




          @dognose thanks for your answer. but I don't want to repeat the mysql_query(),mysqli_fetch_array() functions, I need a function to pass a query and return the result as an array. I just want to reduce my lines of code
          – Brindha Baskaran
          Nov 19 at 9:58










          up vote
          0
          down vote













          In your query you filtered employers by the ID
          WHERE EmpId='1' limit 1



          If you wants to get all records, delete this statement.






          share|improve this answer























          • Changed to $qry="SELECT * FROM tbs_employee WHERE EmpId='1' "; but same result
            – Brindha Baskaran
            Nov 19 at 9:20










          • delete WHERE EmpId='1' statement as I advice you in answer
            – Oleg Nurutdinov
            Nov 19 at 9:21










          • you query sholud be "SELECT * FROM tbs_employee"
            – Oleg Nurutdinov
            Nov 19 at 9:22










          • tried $qry="SELECT * FROM tbs_employee WHERE 1 "; but the result is 0-2:test Employee 1-2:test Employee 2-2:test Employee 3-2:test Employee 4-2:test Employee 5-2:test Employee 6-2:test Employee 7-2:test Employee
            – Brindha Baskaran
            Nov 19 at 9:23












          • @BrindhaBaskaran you query sholud be "SELECT * FROM tbs_employee"
            – Oleg Nurutdinov
            Nov 19 at 9:25















          up vote
          0
          down vote













          In your query you filtered employers by the ID
          WHERE EmpId='1' limit 1



          If you wants to get all records, delete this statement.






          share|improve this answer























          • Changed to $qry="SELECT * FROM tbs_employee WHERE EmpId='1' "; but same result
            – Brindha Baskaran
            Nov 19 at 9:20










          • delete WHERE EmpId='1' statement as I advice you in answer
            – Oleg Nurutdinov
            Nov 19 at 9:21










          • you query sholud be "SELECT * FROM tbs_employee"
            – Oleg Nurutdinov
            Nov 19 at 9:22










          • tried $qry="SELECT * FROM tbs_employee WHERE 1 "; but the result is 0-2:test Employee 1-2:test Employee 2-2:test Employee 3-2:test Employee 4-2:test Employee 5-2:test Employee 6-2:test Employee 7-2:test Employee
            – Brindha Baskaran
            Nov 19 at 9:23












          • @BrindhaBaskaran you query sholud be "SELECT * FROM tbs_employee"
            – Oleg Nurutdinov
            Nov 19 at 9:25













          up vote
          0
          down vote










          up vote
          0
          down vote









          In your query you filtered employers by the ID
          WHERE EmpId='1' limit 1



          If you wants to get all records, delete this statement.






          share|improve this answer














          In your query you filtered employers by the ID
          WHERE EmpId='1' limit 1



          If you wants to get all records, delete this statement.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 19 at 9:22

























          answered Nov 19 at 9:19









          Oleg Nurutdinov

          344213




          344213












          • Changed to $qry="SELECT * FROM tbs_employee WHERE EmpId='1' "; but same result
            – Brindha Baskaran
            Nov 19 at 9:20










          • delete WHERE EmpId='1' statement as I advice you in answer
            – Oleg Nurutdinov
            Nov 19 at 9:21










          • you query sholud be "SELECT * FROM tbs_employee"
            – Oleg Nurutdinov
            Nov 19 at 9:22










          • tried $qry="SELECT * FROM tbs_employee WHERE 1 "; but the result is 0-2:test Employee 1-2:test Employee 2-2:test Employee 3-2:test Employee 4-2:test Employee 5-2:test Employee 6-2:test Employee 7-2:test Employee
            – Brindha Baskaran
            Nov 19 at 9:23












          • @BrindhaBaskaran you query sholud be "SELECT * FROM tbs_employee"
            – Oleg Nurutdinov
            Nov 19 at 9:25


















          • Changed to $qry="SELECT * FROM tbs_employee WHERE EmpId='1' "; but same result
            – Brindha Baskaran
            Nov 19 at 9:20










          • delete WHERE EmpId='1' statement as I advice you in answer
            – Oleg Nurutdinov
            Nov 19 at 9:21










          • you query sholud be "SELECT * FROM tbs_employee"
            – Oleg Nurutdinov
            Nov 19 at 9:22










          • tried $qry="SELECT * FROM tbs_employee WHERE 1 "; but the result is 0-2:test Employee 1-2:test Employee 2-2:test Employee 3-2:test Employee 4-2:test Employee 5-2:test Employee 6-2:test Employee 7-2:test Employee
            – Brindha Baskaran
            Nov 19 at 9:23












          • @BrindhaBaskaran you query sholud be "SELECT * FROM tbs_employee"
            – Oleg Nurutdinov
            Nov 19 at 9:25
















          Changed to $qry="SELECT * FROM tbs_employee WHERE EmpId='1' "; but same result
          – Brindha Baskaran
          Nov 19 at 9:20




          Changed to $qry="SELECT * FROM tbs_employee WHERE EmpId='1' "; but same result
          – Brindha Baskaran
          Nov 19 at 9:20












          delete WHERE EmpId='1' statement as I advice you in answer
          – Oleg Nurutdinov
          Nov 19 at 9:21




          delete WHERE EmpId='1' statement as I advice you in answer
          – Oleg Nurutdinov
          Nov 19 at 9:21












          you query sholud be "SELECT * FROM tbs_employee"
          – Oleg Nurutdinov
          Nov 19 at 9:22




          you query sholud be "SELECT * FROM tbs_employee"
          – Oleg Nurutdinov
          Nov 19 at 9:22












          tried $qry="SELECT * FROM tbs_employee WHERE 1 "; but the result is 0-2:test Employee 1-2:test Employee 2-2:test Employee 3-2:test Employee 4-2:test Employee 5-2:test Employee 6-2:test Employee 7-2:test Employee
          – Brindha Baskaran
          Nov 19 at 9:23






          tried $qry="SELECT * FROM tbs_employee WHERE 1 "; but the result is 0-2:test Employee 1-2:test Employee 2-2:test Employee 3-2:test Employee 4-2:test Employee 5-2:test Employee 6-2:test Employee 7-2:test Employee
          – Brindha Baskaran
          Nov 19 at 9:23














          @BrindhaBaskaran you query sholud be "SELECT * FROM tbs_employee"
          – Oleg Nurutdinov
          Nov 19 at 9:25




          @BrindhaBaskaran you query sholud be "SELECT * FROM tbs_employee"
          – Oleg Nurutdinov
          Nov 19 at 9:25


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371484%2fphp-function-array-returning-one-records-many-times%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Ottavio Pratesi

          Tricia Helfer

          15 giugno