我如何在mysql中检索表id

时间:2011-01-04 18:03:59

标签: 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.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>

1 个答案:

答案 0 :(得分:3)

您将需要使用mysql函数concat

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