Jump to content

date problem to display the data..


zura08

Recommended Posts

i have the problem on sql code. i want to display the data between 1month after the current date..

 

$sql = "SELECT Kod_siri,Nama_item,Tarikh_luput,Kuantiti FROM stok where Tarikh_luput >='CURDATE()+ INTERVAL 30 DAY  ' order by Kod_siri";

 

is this the correct sql query..

Link to comment
Share on other sites

<?php

$CURDATE = date("yyyy-mm-dd");

 

$date = date("yyyy-mm-dd",strtotime("+ 1 month"));

$conn=mysql_connect("localhost","root","") or die("TIDAK boleh buat SAMBUNGAN ke MySQL!");

$db=mysql_select_db("zns_inventori",$conn);

$sql = "SELECT Kod_siri,Nama_item,Tarikh_luput,Kuantiti FROM stok where DATE_SUB(CURDATE(),INTERVAL 30 DAY) >= Tarikh_luput order by Kod_siri" ;

 

$rs = mysql_query($sql, $conn);

$bil_rekod = mysql_num_rows($rs);

if ($bil_rekod <= 0)

{

 

echo "<center><b>Tiada produk yang menghampiri tarikh luput bulan ini.<b></center>";

//header("location:welcomes.php");

exit();

}

else

 

?>

 

 

can i do with this sql??

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.