search

Home  >  Q&A  >  body text

How to extract specified field data from mysql data table in php

 $result = mysql_query("select * from brand order by yesterday_str");
                while($row = mysql_fetch_array($result))
                  {
                  echo "'".$row['yesterday_str']."'";
                  echo ",";
                  }

Now I can extract all field data in the brand table through the above method

There are 7 fields in the brand table: a, b, c, d, e, f, g.
How can I modify it to extract only the data of the 5 fields abcfg?

PHP中文网PHP中文网2755 days ago430

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-16 13:12:22

     $result = mysql_query("select a,b,c,f,g from brand order by yesterday_str");
                    while($row = mysql_fetch_array($result))
                      {
                      echo "'".$row['yesterday_str']."'";
                      echo ",";
                      }
                      
                      //这样就好了吧????

    reply
    0
  • Cancelreply