how to select two columns from two tables in mysql

后端 未结 3 1603
长情又很酷
长情又很酷 2021-01-16 23:44

I am trying to execute this query but i got error \" Undefined index: lname\".I want to count row from one column(fname) from table a and select column(ln

3条回答
  •  感情败类
    2021-01-17 00:21

    If you still get an error you can try to fetch both separately:

    $result = mysql_query("SELECT COUNT(fname) FROM a");
    while ($row = mysql_fetch_array($result))
      {
        echo "";
        echo $row['COUNT(fname)'];
        echo "";
    
      }
    
    $result1 = mysql_query("SELECT lname FROM b");
    while ($row = mysql_fetch_array($result1))
        {
          echo "";
          echo $row['lname'];
          echo "";
       }
    

提交回复
热议问题