select and echo a single field from mysql db using PHP

前端 未结 4 782
一生所求
一生所求 2021-02-02 16:46

Im trying to select the title column from a particular row

$eventid = $_GET[\'id\'];
$field = $_GET[\'field\'];
$result = mysql_query(\"SELECT $field FROM `event         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 17:23

    Read the manual, it covers it very well: http://php.net/manual/en/function.mysql-query.php

    Usually you do something like this:

    while ($row = mysql_fetch_assoc($result)) {
      echo $row['firstname'];
      echo $row['lastname'];
      echo $row['address'];
      echo $row['age'];
    }
    

提交回复
热议问题