Application Number to be reset 1 every starting of new year how plz help me out in PHP, MYSQL
<?php
/***************************************************************** Author - Nilesh Madhukar Ghadi Compiled on - 29-06-2014 Desigination- Computer Programmer Office - Office of the Special COurt, Bombay ******************************************************************/ session_start(); // Starting sesssion // Connecting to the mysql database require_once 'dbconnect.php'; if(!mysql_connect($db_hostname,$db_username,$db_password)) die("Unable to connect the database"); if(!mysql_select_db($db_database)) die("Unable to connect the database"); { //Now I'm defining various variables $appyr = htmlspecialchars(mysql_real_escape_string($_POST['appyr'])); $appldt = htmlspecialchars(mysql_real_escape_string($_POST['appldt']));/* Mysql_real_escape_string helps to pervent sql injections*/ $appname =strtoupper(htmlspecialchars(mysql_real_escape_string($_POST['appname']))); $myselectbox = htmlspecialchars(mysql_real_escape_string($_POST['myselectbox'])); $caseeno = htmlspecialchars(mysql_real_escape_string($_POST['caseeno'])); $caseyr = htmlspecialchars(mysql_real_escape_string($_POST['caseyr'])); $orddt = htmlspecialchars(mysql_real_escape_string($_POST['orddt'])); $cc = htmlspecialchars(mysql_real_escape_string($_POST['cc'])); $cstatus = htmlspecialchars(mysql_real_escape_string($_POST['cstatus'])); $mytextarea = strtoupper(htmlspecialchars(mysql_real_escape_string($_POST['mytextarea']))); $sql = "INSERT INTO certcopy (cappyr,ccappdt,applname,mattercat,matterno,matteryr,mattorddt,ccopy,status,remarks) VALUES ('$appyr','$appldt','$appname','$myselectbox','$caseeno','$caseyr','$orddt','$cc','$cstatus','$mytextarea')";/* SQL command to insert into database*/ $result = mysql_query($sql); // Performed query $id = mysql_insert_id(); if ($result) { ?> <table class ="appentry" width="60%" align="center" border="0" cellpadding="2" cellspacing="5" bgcolor="#eeeeeee"> <tr> <td> <?php print "<tr><td align=center><font size=+2><b><i>OFFICE OF THE SPECIAL COURT (TORTS), BOMBAY</b></i></font><br></td></tr>"; print "<tr><td align=center><font size=+1><b><i>(Trial of Offences Relating to Transactions in Securities)</b><br></i></font></td></tr>"; print "<tr><td align=center><font size=+1><b><i>Room No.25, 3rd floor, High Court Annex Building, Bombay.</b><br><br><br></i></font></td></tr>"; print "<tr><td align=center><font size=+2 color=blue>CERTIFIED COPY APPLICATION NO. : </font>"; print "<font size=+2 color=blue>". mysql_insert_id();"</font></td>,/tr>"; print "/"; print "$appyr"; } } ?> </td> </tr> <tr> <td align="center"> <b><u>Note :- Please refer above certified copy application Number for future correspondence..!</b></u> </td> </tr> </table> |
© Advanced Web Core. All rights reserved