FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


HomeWatched TopicsRegisterSearchDirectory
FAQMemberlistUsergroupsLog inStoresItemsBank
Google

Reply to topic Page 1 of 1
End Date value to not allow update if date is = or greater
Message  

Reply with quote
Post End Date value to not allow update if date is = or greater 
i need to NOT allow updates on my records, should the value in the [ end_on ] field be equal to or greater than todays date.

i do not have any idea how to code, i only know html and use dreamweaver as an intermediate webmaster, and i use AppGini to create php pages that connect to mysql server.

here is my php update codes, hope someone can help.. because i forgot about this one last bit of coding that would be needed for my auction project. thank you

function update($selected_id)
{
  global $HTTP_SERVER_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS, $Translation;
    
    if(get_magic_quotes_gpc())
  {
           $username = addslashes($_SESSION["username"]);
            $unitrade = $HTTP_POST_VARS["unitrade"];
          $title = $HTTP_POST_VARS["title"];
                $condition = $HTTP_POST_VARS["condition"];
                $cat_value = $HTTP_POST_VARS["cat_value"];
                $price_cad = $HTTP_POST_VARS["price_cad"];
                $detail = $HTTP_POST_VARS["detail"];
              $image = $HTTP_POST_VARS["image"];
                $end_on = $HTTP_POST_VARS["end_onYear"] . '-' . $HTTP_POST_VARS["end_onMonth"] . '-' . $HTTP_POST_VARS["end_onDay"];
      }
   else
        {
           $username = addslashes($_SESSION["username"]);
            $unitrade = addslashes($HTTP_POST_VARS["unitrade"]);
              $title = addslashes($HTTP_POST_VARS["title"]);
            $condition = addslashes($HTTP_POST_VARS["condition"]);
            $cat_value = addslashes($HTTP_POST_VARS["cat_value"]);
            $price_cad = addslashes($HTTP_POST_VARS["price_cad"]);
            $detail = addslashes($HTTP_POST_VARS["detail"]);
          $image = addslashes($HTTP_POST_VARS["image"]);
            $end_on = $HTTP_POST_VARS["end_onYear"] . '-' . $HTTP_POST_VARS["end_onMonth"] . '-' . $HTTP_POST_VARS["end_onDay"];
      }

    sql("update auctions set " . "price_cad=" . (($price_cad != "") ? "'$price_cad'" : "NULL") . ", username='$username' where lot_number='$selected_id' and price_cad < $price_cad");

}

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

Reply with quote
Post  
Well the first thing you would want to do is read the end_on field from the database and check it against todays date.  Then do the appropriate action from there.

View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger

Reply with quote
Post  
Well if you can't code anything in PHP, this is gonna be hard for you.  There is no EASY way unless you can find someone to do it for you.  And this can be hard to do unless you are willing to pay for it.

View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger

Reply with quote
Post  
Go to www.php.net and look up the command gmdate() and mktime()

I recently had the same problem trying to update logged in members at my forum and expiring them after a certain time.

From these two commands and a datetime column in your database you can achieve what is needed.

It would look similiar to;

Code:

$next_month = mktime (gmdate("H"), gmdate("i"), gmdate("s"), gmdate("m")+1, gmdate("d"), gmdate("Y"));
$later = gmdate("Y-m-d H:i:s", $next_month);


This command will get a date from today to next month.

The next step would be to INSERT the $next_month value into the datetime column in your database.

Finally, when someone returns to your site you need to extract the datetime you inserted into the database, and compare it against todays date.
Code:

$today = gmdate("Y-m-d H:i:s");
$query = "SELECT datetime FROM database WHERE youknowthispart";
$result = mysql_query($query,$database_link);
$next_month = mysql_result($result,0);
// Compare
if ($today > $next_month) {
echo "Today is greater than next month";
} else {
echo "Today is not greater than next month";
}


I hope this gives you some tips on how to do this.

View user's profile Send private message
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  



Google

FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


Web Design by PlatinumShore.com & Web Hosting by TradeWebHosting.com