Jump to content
Sign in to follow this  
deejagothic

Date In Sql

Recommended Posts

Askum..

aku baru je siap buat satu page.

dalam page ni ade satu input data untk tarikh. skang ni, aku nak buat satu query dari MYSQL dengan syarat menggunakan tarikh!

Ni mysql aku:-

Field tarikh_belanja

Type date

Null No

Default 0000-00-00

$tarikh1 = $tahun . $bulan . "01";
$tarikh2 = $tahun . $bulan . "31";
$query = "SELECT * FROM `belanja_akaun` WHERE `id_pengguna`='" . $_SESSION['id_pengguna'] ."' AND `tarikh_belanja` >= $tarikh1 AND `tarikh_belanja` < $tarikh2";

Sql syntax yg aku pakai ade maslah koboi pada WHERE clause

tapi code aku jalan dan takde masalah...cume skang ni aku rasa code SQL yg aku pakai cam kurang ke'robustness'nye..

Sesape yang ade idea utk dapatkan SQL syntax yg lebih baik dari yg aku buat dialu-alukan...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...