Read one column from one row from a MySQL database

前端 未结 8 1990
没有蜡笔的小新
没有蜡笔的小新 2021-01-15 03:30

Is there a quick and dirty way to get the value of one column from one row? Right now I use something like this:

$result = mysql_query(\"SELECT value FROM ta         


        
8条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-15 04:12

    if you want it to return only one value use the limit keyword

    /* Limits Results to 1 */
    $result = mysql_query("SELECT value FROM table WHERE row_id='1' LIMIT 1;");
    $row = mysqli_fetch_assoc($result)
    echo $row['value'];
    

提交回复
热议问题