Php 如何在mysql中检索表id

Php 如何在mysql中检索表id,php,mysql,Php,Mysql,如何在不涉及PHP的情况下在mysql中检索表id?还是有可能 $q = $mysqli->query("SELECT id_timeslot, id_bookslot ,coalesce(thera_a, '<a href=\"available.php?id_timeslot='id_timeslot'\" >available</a>') AS thera_a FROM ( SELECT t.id_timeslot,b.i

如何在不涉及PHP的情况下在mysql中检索表id?还是有可能

 $q = $mysqli->query("SELECT id_timeslot, id_bookslot

     ,coalesce(thera_a, '<a href=\"available.php?id_timeslot='id_timeslot'\" >available</a>') 
     AS thera_a

     FROM ( SELECT t.id_timeslot,b.id_bookslot

      ,MAX(CASE WHEN b.date_book='$search_date' AND b.id_beautician=1 THEN '<a href=\"booked.php?id_timeslot=\">booked</a>' END)     
    AS thera_a
从mysql代码中:

<a href=\"available.php?id_timeslot='id_timeslot'\" >available</a>

您需要使用mysql函数concat

SELECT concat('<a href=\"available.php?id_timeslot=', id_timeslot, '\">available</a>') from Table .....

您需要使用mysql函数concat

SELECT concat('<a href=\"available.php?id_timeslot=', id_timeslot, '\">available</a>') from Table .....

等等什么?我想我们需要更多的信息。我不知道你在问什么。从一般意义上说,你到底想完成什么?我永远不会这么做。无论如何,在这种情况下查询数据库需要PHP,所以在获取记录后只需将一些字符串合并在一起。这就是使用服务器端语言的目的。MySQL从来没有被设计来做这种事情。等等什么?我想我们需要更多的信息。我不知道你在问什么。从一般意义上说,你到底想完成什么?我永远不会这么做。无论如何,在这种情况下查询数据库需要PHP,所以在获取记录后只需将一些字符串合并在一起。这就是使用服务器端语言的目的。MySQL从来就不是设计用来做这种事情的。