Click here to Skip to main content
15,889,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to fetch column all rows data and i also do it successfully but always missing my to row data why?

What I have tried:

 <?php
 
  
    include "../pages/connect.php";
    $query = "SELECT * FROM gallery";
    $result = mysql_query($query) or die('Error, query failed');
    $row = mysql_fetch_assoc($result);
    //$filePath = $row['image_name'];
    //$filePath1 = $row['image_path'];
     $filePath2 = $row['path_name'];
   // $path = $filePath1 . $filePath;  

    //$path = $filePath1."1492234583".$filePath;

    //echo $filePath1 . $filePath;
 while ($row=mysql_fetch_array($result))
{
    $filePath2 = $row['path_name'];
    echo $filePath2;
    
    //echo  '<img src=" ../doctorlogin/' . $filePath2 . '"  height="150" widht="150"/>';

    echo "<br>";
    

}
  // echo $filePath2;
    //echo $path;



    
   //echo  '<img src=" ../doctorlogin/' . $filePath2 . '"  height="200" widht="200"/>';



    ?>


always unable to fetch first row. Help me asap. Thanks
Posted
Comments
Nick_3141592654 15-Apr-17 4:57am    
It would help if you remove the blank lines and commented-out code from your posting.

Much better to post only the code that's relevant to the issue, and the minimum code that can reproduce the issue.

I wonder if you're expecting to see the column IDs in your results, as you do when viewing the table in your favourite MySQL GUI tool? If so, you won't: you will see only the DATA that you've inserted to the table.

I made a simple table example for you at http://sqlfiddle.com/#!9/0a1a4a/1 with three columns ColA, ColB, ColC and three inserted rows of data. Your query is shown in tabular form. In this case the results do show "ColA", .., "ColC" in the first row of HTML but note that the query response is indicating that THREE results have been obtained, i.e. one for each row of DATA in the table. This is of course correct.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900