return one value from database with mysql php pdo

前端 未结 3 776
孤街浪徒
孤街浪徒 2020-11-30 06:19

Im not trying to use a loop. I just one one value from one column from one row. I got what I want with the following code but there has to be an easier way using PDO.

<
3条回答
  •  忘掉有多难
    2020-11-30 07:00

    Just like it's far too much work to have to get into your car, drive to the store, fight your way through the crowds, grab that jug of milk you need, then fight your way back home, just so you can have a milkshake.

    All of those stages are necessary, and each subsequent step depends on the previous ones having been performed.

    If you do this repeatedly, then by all means wrap a function around it so you can reuse it and reduce it down to a single getMyValue() call - but in the background all that code still must be present.

提交回复
热议问题