$bugun = date("Y-m-d");
$dogum_cek = mysql_query("SELECT * FROM secim_uyeleri WHERE STR_TO_DATE(uye_dogum,'%d-%m-%Y') = '".$bugun."'");
while ($a= mysql_fetch_array($dogum_cek)){
$uye_dogum = $a['uye_dogum'];
$uye_isim = $a['uye_isim'];
$uye_tel = $a['uye_tel'];
echo'
<tr>
<td>'.$uye_isim.'</td>
<td>'.$uye_tel.'</td>
<td>'.$uye_dogum.'</td>
</tr>';}
我在mysql表中有varChar列,我保留了生日。(因为包括excel而插入varChar。)所以现在我必须检索当前天有生日的行。我尝试使用str_to_date来检索varChar作为日期,但无法获得任何结果。
“uye_dogum”是varChar列,我将生日保存为dd-mm-YYYY。
SELECT * FROM secim_uyeleri WHERE ( I NEED THIS PART) = '".$bugun."'
答案 0 :(得分:0)
$bugun = date("d-m");
$dogum_cek = mysql_query("SELECT uye_dogum,uye_isim,uye_tel FROM secim_uyeleri WHERE LEFT(uye_dogum,5) LIKE '".$bugun."' ORDER BY uye_isim");
while ($a= mysql_fetch_array($dogum_cek)){
$uye_dogum = $a['uye_dogum'];
$uye_isim = $a['uye_isim'];
$uye_tel = $a['uye_tel'];
echo'
<tr>
<td>'.$uye_isim.'</td>
<td>'.$uye_tel.'</td>
<td>'.$uye_dogum.'</td>
</tr>';}
解决方案在这里..我可以得到这样的所有行..对于小解决方案,我将使用它..