8) //checking whether the time string is valid or not { echo "The time ($timestr) string is not correct.Please check it again"; exit; } $ch=substr($format,-2); //applicable only when return type is HH:MM if($ch=="_A") //checking whether return format contain _A or not. { $format=substr($format,0,strlen($format)-2); } $ampm=strtolower(substr($timestr,-2)); //fetching am/pm is supplied string is in format hh:mm am/pm if($ampm=="pm" || $ampm=="am" ) $timestr=substr($timestr,0,strlen($timestr)-2); //getting the actual time string by removing the am/pm suffix //$seperator=substr($timestr,2,1); //getting the seprator used to sperate hr and min (e.g :,-,.,;) $char=explode(":",$timestr); //spliting the time by seperator $hh=intval($char[0]); $mm=$char[1]; switch($format) { case "HH:MM"://24 hr format if($ampm=="pm") //if 12 hr format string contains pm then add that value with 12,to make it 24 hr format { if($hh<12) $hh=$hh+12; } else { if($hh==12) //if 12:00 am then in 24 hr format 00:00 AM is there $hh="00"; } if(strlen($hh)==1) //padding 0 if hh is in sigle digit $hh="0".$hh; return "$hh:$mm"; //return the 24 hr format case "hh:mm"://12 hr format if($hh>12 ) //if more than 12 than subtract the value with 12 { if($hh>=24) return "Invalid Time"; $hh=$hh-12; $ampm="PM"; } else if($hh==12) $ampm="PM"; else $ampm="AM"; if(strlen($hh)==1) $hh="0".$hh; if($ch=="_A") //checking whether to return with AM/PM or not $str="$hh:$mm $ampm"; else $str="$hh:$mm"; return $str; } } /***************format_time() ends here******************************************************/ /********************getmydate() function starts from here**************************************/ //this function returns the month of date in textual format //.eg 12/12/2006 will be returned as 12, Dec 2006 //the function contains two prameter. //first parameter is your date string ,this can either be in dd/mm/yyyy or yyyy/mm/dd format //the second parameter is format in which u want ur month . //by default it take null ,which returns first three digit of month, //but if you want the full name of month like Janauary ,you have to pass the field "FULL" as second parameter function gettextdate($yourdate,$format="") { //making month array $month_array=array( "01"=>"January", "02"=>"February", "03"=>"March", "04"=>"April", "05"=>"May", "06"=>"June", "07"=>"July", "08"=>"August", "09"=>"September", "10"=>"October", "11"=>"November", "12"=>"December" ); $char=split("[-/]",$yourdate); //spliting the date if(strlen($char[0])==4) { $dd=strlen($char[2])==1?"0".$char[2]:$char[2]; //padding the zero with month and date if they of length 1 $mm=strlen($char[1])==1?"0".$char[1]:$char[1]; $yyyy=$char[0]; } else { $dd=strlen($char[0])==1?"0".$char[0]:$char[0]; $mm=strlen($char[1])==1?"0".$char[1]:$char[1]; $yyyy=$char[2]; } if(intval($dd)==0 ||intval($mm)==0||intval($yyyy)==0) //if any of field is zero return the null value return; //since the date is not a valid one if($format=="FULL") //if FULL parameter is there than return fullname $mm=$month_array[$mm]; else $mm=substr($month_array[$mm],0,3); //else return only first three digit return "$mm $dd, $yyyy"; //return the formatted date } /*************************getmydate() ends here***********************************************************************/ //---------------------date_diff() start here-------------------------------------- //----this function returns the date difference //---It have three conditions //---1.'d' no of Days (default) //---2.'w' no of Weeks //---2.'AllDates' return the datediffarray //echo date_diff('2006-06-01','2006-06-05','d'); //---print_r(date_diff('2006-06-01','2006-06-05','AllDates')); function vdate_diff($fromdate,$todate,$dtype='d') { $i=0; $fromdate=format_date($fromdate,'yyyy-mm-dd'); $todate=format_date($todate,'yyyy-mm-dd'); if($dtype == 'AllDates') { $today=new Date($todate); $currday=new Date($fromdate); while($currday<$today) { $currday=$currday->dateadd(1,'d'); $thisday[$i]=$currday->CDATE; ++$i; } return $thisday; } if($dtype == 'd') { $datesql ="select DATEDIFF('$todate','$fromdate') as resultdate"; } else if($dtype == 'w') { $datesql ="select week('$todate')-week('$fromdate') as resultdate"; } $takesql = Select_Query($datesql); $rec=mysql_fetch_array($takesql); $resultdate=$rec["resultdate"]; return $resultdate; } // echo time_diff('10:45am','12:55pm','02/02/2007'); function time_diff($fromtime,$totime='00:00',$fromdate='00/00/0000',$todate='00/00/0000') { if($totime == '00:00') { $totime=date('h:i',time()); // $totime = '12:55'; if(date('G',time()) >= 13) $totime = $totime."pm"; } $fromtime = format_time($fromtime,'HH:MM'); $totime = format_time($totime,'HH:MM'); list($fhr,$fmin)=split(':',$fromtime); list($thr,$tmin)=split(':',$totime); if($fromdate == '00/00/0000') $fromdate = date('d/m/Y'); if($todate == '00/00/0000') $todate = date('d/m/Y'); if($fromdate == $todate) { if($thr >= $fhr) $totalhr = $thr-$fhr; if($tmin >= $fmin) $totalmin = $tmin-$fmin; if(strlen($totalmin) == 1) $totalmin = "0".$totalmin; if(strlen($totalhr) == 1) $totalhr = "0".$totalhr; $totaltime = $totalhr.":".$totalmin; } else { $fromdate=format_date($fromdate,'yyyy-mm-dd'); $todate=format_date($todate,'yyyy-mm-dd'); $fdtobj = new date($fromdate); $tdtobj = new date($todate); while($fdtobj <= $tdtobj) { $i++; if($fdtobj == $tdtobj) { $hr+=$thr; break; } if($i == 1) $hr = 24-$fhr; else $hr+=24; $fdtobj=$fdtobj->dateadd(1,'d'); } $fminobj = new date($fromdate); $tminobj = new date($todate); if($fminobj < $tminobj) { $totalmin = (60-$fmin)+$tmin; } while($totalmin >= 60) { $totalmin = $totalmin-60; if($totalmin == 0) break; } if(strlen($totalmin) == 1) $totalmin = "0".$totalmin; $totaltime = $hr.":".$totalmin; } return $totaltime; } //---------------------timestamp_to_datetimeday() start here-------------------------------------- //----this function returns the date time day //---It have 4 conditions //---1.'dt' date (default) //---2.'d' day //---3.'t' time //---4.'All' return the date time day array //---print_r(timestamp_to_datetimeday(1144062935,'d')) function timestamp_to_datetimeday($timestamp,$defaulttime='dt') { $timesql = "select FROM_UNIXTIME($timestamp,'%d/%m/%Y-%h:%i:%s-%p-%W') as datetimeday "; $taketimesql = Select_Query($timesql); //$taketimesql=mysql_query($timesql); $loadrec=mysql_fetch_array($taketimesql); $datetimeday = $loadrec["datetimeday"]; list($dd,$tt,$ampm,$day) = split('[-]',$datetimeday); mysql_free_result($taketimesql); switch($defaulttime) { case 'All': $dtdarr[0]=$dd; $dtdarr[1]=$tt; $dtdarr[2]=$ampm; $dtdarr[3]=$day; break; case 'dt': $dtdarr=$dd; break; case 't': $dtdarr=$tt.$ampm; break; case 'd': $dtdarr=$day; break; } return $dtdarr; } //echo datetime_to_timestamp('2006-12-12','12:30'); function datetime_to_timestamp($date,$time='00:00') { $date=format_date($date,'yyyy-mm-dd'); // $time = format_time($time,'HH:MM'); $datetimesql ="select UNIX_TIMESTAMP('$date $time') as dttimestamp"; $takedtsql = Select_Query($datetimesql); $loadrec=mysql_fetch_array($takedtsql); $dttimestamp=$loadrec["dttimestamp"]; return $dttimestamp; } //echo getimageview(); function fillselectedcombo($sqlqry,$myid) { $rec = Select_Query($sqlqry); while ($row=mysql_fetch_array($rec)) { $id = $row["0"]; $name = $row["1"]; if (trim($id)==$myid) $selected = " SELECTED "; Else $selected = " "; $mylist .= ""; } mysql_free_result($rec); return $mylist; } //echo numtochar(123); function numtoword($Figure) { $num = $Figure; $L = 1; $X = 10000000; $unt = "ONE TWO THREE FOUR FIVE SIX SEVEN EIGHT NINE TEN ELEVEN TWELVE THIRTEEN FOURTEEN FIFTEEN SIXTEEN SEVENTEEN EIGNTEEN NINTEEN "; $ten = "TWENTY THIRTY FOURTY FIFTY SIXTY SEVENTY EIGHTY NINTY "; $clth = "CRORE LAKH THOUSAND HUNDRED "; While ($L <= 60) { If ($num >= $X) { If ($num < 1) { If ($num > 0) { $num = substr($num,1,3); $n = $num * 100; $word = "RS." . $word . " AND PAISA"; } Else { $word = $word; } } Else { $n = intval ($num / $X); $num = $num - ($n * $X); } If ($n > 19) { $xx = intval ($n / 10) * 10; $word = $word . " " . RTrim (substr ($ten, ($xx - 19)-1, 10)); $n = $n - $xx; } If ($n > 0) { $word = $word . " " . RTrim (substr ($unt, ($n * 10 - 9)-1, 10)); } $word = $word . " " . RTrim (substr ($clth, $L-1, 10)); } $L = $L + 10; If ($X == 1000) { $X = 100; } else { $X = $X / 100; } } $w1 = $word . ""; return $w1; } // only convert number to string function convertnumtoword($Figure) { $num = $Figure; $L = 1; $X = 10000000; $unt = "One Two Three Four Five Six Seven Eight Nine Ten Eleven Twelve Thirteen Fourteen Fifteen Sixteen Seventeen Eignteen Ninteen "; $ten = "Twenty Thirty Fourty Fifty Sixty Seventy Eight Ninty "; $clth = "Crore Lakh Thousand Hundred "; While ($L <= 60) { If ($num >= $X) { If ($num < 1) { If ($num > 0) { $num = substr($num,1,3); $n = $num * 100; } Else { $word = $word; } } Else { $n = intval ($num / $X); $num = $num - ($n * $X); } If ($n > 19) { $xx = intval ($n / 10) * 10; $word = $word . " " . RTrim (substr ($ten, ($xx - 19)-1, 10)); $n = $n - $xx; } If ($n > 0) { $word = $word . " " . RTrim (substr ($unt, ($n * 10 - 9)-1, 10)); } $word = $word . " " . RTrim (substr ($clth, $L-1, 10)); } $L = $L + 10; If ($X == 1000) { $X = 100; } else { $X = $X / 100; } } $w1 = $word ; return $w1; } // /*$name="jinu"; $classname="fourth"; $str="$name-studentname,$classname-ClassName";*/ //chkvalidationforblankentry($str); function formvalidation($str) { $arr = explode(",",$str); for($i=0;$i".$fieldcaption." can't be left blank "; break; } //~ echo $fieldvalue."
"; //~ echo $fieldcaption."
"; } } //--cpagelink("studentchklink.as?stuid=1",$noofrows,$noofq,$pageno); function cpagelink($scriptlink,$noofrows,$noofq,$pageno=1) { global $singlepg; global $backpg; if ($noofrows > $noofq) { if(intval($noofrows/$noofq)==($noofrows/$noofq)) { $pagecount = round($noofrows/$noofq); } else { $pagecount = intval($noofrows/$noofq) + 1; } // echo "Pagecount : $pagecount
"; $showpgno=$pageno; if($singlepg != '') $pageno = $singlepg; if($backpg == 'bpg') $pageno = $pageno-$noofq; echo ""; echo ""; else echo "<< Back "; //starting of loop// echo ""; echo ""; else echo "Next >> "; echo "
"; if ($pageno == 1) echo "<< Back"; echo "Page No : "; for($i=$pageno;$i < $pageno+$noofq;++$i) { if ($i > $pagecount) break; if ($i == $showpgno) { echo $showpgno . " "; } else { echo "$i" . " "; } } //ending of loop// echo ""; if ($i > $pagecount) echo "Next >>
"; } } //this function is used to get the script variable function Get_Script_Variable($ScriptId,$LangId=0) { $ssql=" select VarName,DefVal, ( select VarValue From ScriptVarTrans Where ScriptVarId =ScriptVar.Id and LangId=$LangId ) as VarValue from ScriptVar where ScriptId=$ScriptId"; $rsScriptVar =@mysql_query($ssql); while($rsScriptVarRec =@mysql_fetch_array($rsScriptVar)) { $myVar=$rsScriptVarRec["VarName"]; $tmpvalue=$rsScriptVarRec["VarValue"]; //put default value if no language specification value if defined if(is_null($tmpvalue)) $tmpvalue=$rsScriptVarRec["DefVal"]; global $$myVar; $$myVar=$tmpvalue; } }// end function Get_Script_Variable function agecalculate($dob,$calctype='YMD')//--Y-m-d { $dob=format_date($dob,'yyyy-mm-dd'); $mydob = new Date($dob); list($dy,$dm,$dd) = split('[/-]',$dob); $todaydate = new Date(date('Y-m-d')); $diff = $mydob->datediff($todaydate); if($diff>0) { $myagey=intval($diff/365); $mydatediff = $diff-($myagey*365); if ($mydatediff==0 || $mydatediff<0) { $myagem=0; } else { $myagem = round(($mydatediff / 30),0); } if($myagem==0) $newage=$myagey." Yrs"; else if($calctype == 'YM') $newage=$myagey." Yrs ".$myagem." Months"; else { $myagem = $myagem-1; $str = date('Y-m-d',mktime(0,0,0,date('m'),$dd,date('Y'))); $str1 = new Date($str); $dtdiff = $str1->datediff($todaydate); if($dtdiff > 0) $dayscond = $dtdiff." Days"; $newage=$myagey." Yrs ".$myagem." Months ".$dayscond; } } else $newage = ''; return $newage; } function sessioncombo() { $sessquery="SELECT sessid,caption FROM sessions WHERE removed='N' ORDER BY sessid DESC"; $sessrow=Select_Query($sessquery); echo ""; } //fumction for printing the messages function PrintMessage($message,$type="NORMAL") { if($message!="") { echo '
'.$message.'
'; } }//here the function PrintMessage ends function getmydate($yourdate) { if($yourdate!="0000-00-00") { list ($year,$month,$day) = split('[/-]',$yourdate); $mydate = date("d M, Y",mktime(0,0,0,$month,$day,$year)); } else { $mydate = ""; } return $mydate; } // function getmydate ends here //time function function mytime(){ $mytime = getdate(time()); $curtime = $mytime["hours"] . ":" . $mytime["minutes"] . ":" . $mytime["seconds"]; return $curtime; } //function for get date and time from mysql timestamp field function GetTime($timestamp) { $Year = substr($timestamp,0,4); $Month = substr($timestamp,4,2); $Day = substr($timestamp,6,2); $Hour = substr($timestamp,8,2); $Min = substr($timestamp,10,2); $Sec = substr($timestamp,12,2); $UnixTimeS=mktime($Hour,$Min,$Sec,$Month,$Day,$Year); $MyDate = date("d M, Y - G:i:s",$UnixTimeS); return $MyDate; } Function GetDateOnly($timestamp) { $Year = substr($timestamp,0,4); $Month = substr($timestamp,4,2); $Day = substr($timestamp,6,2); $DateOnly=$Year."/".$Month."/".$Day; return $DateOnly; } function getdateformat($yourdate, $dateformat) { @list ($year,$month,$day) = split('[/-]',$yourdate); $mydate = @date($dateformat,mktime(0,0,0,$month,$day,$year)); return $mydate; } function goterror($message) { $datenow = date("d M, Y"); $timenow = date("h:i:s"); $message .= " \n\n This error is been occured at time $timenow on the date $datenow \n "; @mail ("error1@dreamteamonline.com","Error Occured On SIte",$message,"From: " . "error@dtns.com"); } function connectionerr($sitename) { $mysqlr = "Mysql Connection Error Occured on your site Site : $sitename On Date : " . date("d/M/Y") . "\nTime : " . date("h:i:s"); goterror($mysqlr); header ("Location: error.as"); exit(); } function getmydateddmmyyyy($yourdate) { list ($year,$month,$day) = split('[/-]',$yourdate); $mydate = $day."/".$month."/".$year; return $mydate; } function displaymsg($msg, $font='arial', $size=2,$color='#000000') { echo ""; echo $msg; echo ""; } function converttotimestamp($val) { list($h,$m)=split("[\.:]",$val); $mtiming=mktime($h,$m); return $mtiming; } function getformattedtime($val,$timeformat="h:i A") { $timing=date($timeformat,$val); return $timing; } // A function to return the Roman Numeral, given an integer function numberToRoman($num) { // Make sure that we only use the integer portion of the value $n = intval($num); $result = ''; // Declare a lookup array that we will use to traverse the number: $lookup = array('M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400, 'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40, 'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1); foreach ($lookup as $roman => $value) { // Determine the number of matches $matches = intval($n / $value); // Store that many characters $result .= str_repeat($roman, $matches); // Substract that from the number $n = $n % $value; } // The Roman numeral should be built, return it return $result; } function GetMonthName($MonthId) { switch($MonthId) { case 1: $MonthName="Jan"; break; case 2: $MonthName="Feb"; break; case 3: $MonthName="March"; break; case 4: $MonthName="April"; break; case 5: $MonthName="May"; break; case 6: $MonthName="June"; break; case 7: $MonthName="July"; break; case 8: $MonthName="Aug"; break; case 9: $MonthName="Sep"; break; case 10: $MonthName="Oct"; break; case 11: $MonthName="Nov"; break; case 12: $MonthName="Dec"; break; } return $MonthName; } ?> $sql
Error :".mysql_error().""; //echo "$MSG_QUERY_ERROR in script ".array_pop(explode("/", getenv("SCRIPT_NAME"))).""; echo $sql; exit; } if($return_type=="SINGLEROW" || $return_type=="SINGLEROW_1") { if(mysql_num_rows($result)>1) { echo "Query:$sql
Your query returns more than 1 row,please either change the condition or change the return type"; exit; } if(mysql_num_rows($result)==1) { $row=mysql_fetch_array($result); mysql_free_result($result); if($return_type=="SINGLEROW") return $row; else if($return_type=="SINGLEROW_1") return $row[0]; } } else if($return_type=="COUNT") { $count=mysql_num_rows($result); mysql_free_result($result); return $count; } else return $result; } //***************Here the function SelectQuery($query,$type) working ends********************************/ //the function GetMaxMinValue will return max or min value of specied field and table //the first parameter is for fieldname //the second parameter is for tablename //the third parameter is for condition specified by user on which max or min value will be find //the forth parameter is for getting type of value return ,if the queryup is false means max value else means min value //the fifth parameter is for incrementing or decrementing the return value by $incr variable passed by user // its depanding on queryup flag,(optional field) function MaxMin_Query($fieldname,$tablename,$condition="",$queryup=false,$incr=0) { //echo $queryup;echo $incr; if($queryup) $type="min"; else $type="max"; if($condition!="") $condition="where ".$condition; $sql="select $type($fieldname) as myvalue from $tablename $condition"; $row=Select_Query($sql,"SINGLEROW_1"); if(intval($incr)!=0) { if($queryup) { $row=intval($row)-$incr; //echo $row;echo "vipin";echo $incr; if($row==0) { $row=-1; } } else { $row=intval($row)+$incr; //echo $row;echo "vipin"; if($row==0) { $row=1; } } } //exit; return $row; } /***************Here MaxMin_Query ends********************************************************/ /***************Function isDuplicate_Query()*****************************************************/ //this function will check whether the given value of specified field and table , //is already present in that table or not. //this function takes four parameters //first :tablename (must not be an array) //second :fieldname //third :value correspound to field //fourth :this is optional one.this field contains condition specified by you,for //filtering the duplicate search. (this field must not be an array) function isDuplicate_Query($tablename,$fieldname,$fieldvalue,$condition="") { if(is_array($fieldname) && is_array($fieldvalue)) { if($condition!="") $condition= " and ".$condition; $len=count($fieldname); for($i=0;$i<$len;$i++) { $fieldvalue[$i]=trim($fieldvalue[$i]); $fieldcondition="where trim($fieldname[$i])='$fieldvalue[$i]' ".$condition; $sql="select $fieldname[$i] from $tablename $fieldcondition"; //echo $sql;exit; if(RunMy_Query($sql)) return true; unset($fieldcondition); } } else { if($condition!="") $condition=" and ".$condition; $fieldvalue=trim($fieldvalue); $condition="where trim($fieldname)='$fieldvalue' ".$condition; $sql="select $fieldname from $tablename $condition"; //echo $sql;exit; if(RunMy_Query($sql)) return true; else return false; } return false; } /***************************isDuplicate_Query() ends here**********************************/ /************************isExists_Query($tablename,$fieldname,$value,$condition) ************/ //this function will check the refrenceses of the specified value in the specified tables //w.r.t there fields //the first parameter:this hold the tablenames in which you to check the refrence //the second parameter:this hold the fieldnames w.r.t tables ,on which refrence value is checked //the third parameter:this hold the value ,which refrence you want to check,this variable hold a single value //the fourth parameter:this hold the conditions w.r.t tables for filtering the check. //the parameter value must not be an array. function isExists_Query($tablename,$fieldname,$value,$condition="") { if(is_array($tablename)) { $len=count($tablename); for($i=0;$i<$len;$i++) { if(is_array($fieldname)) $field=$fieldname[$i]; else $field=$fieldname; if(is_array($condition)) $mycondition=$condition[$i]; else $mycondition=$condition; $query_condition="where ".$field."='$value' "; if($mycondition!="") $query_condition.="and ".$mycondition; $sql="select ".$field." from $tablename[$i] ".$query_condition; if(RunMy_Query($sql)) return true; unset($query_condition); } } else { if($condition!="") $condition=" and ".$condition; $condition="where ".$fieldname."='$value' ".$condition; $sql="select ".$fieldname." from $tablename $condition"; if(RunMy_Query($sql)) return true; } } /********************isExists_Query() function ends here*************************************/ //this function will remove data from the table which having field removed='Y' //the removed data will be stored in .doc file starting from DataDelete prifix. //Removed_Parmamently(); function Removed_Parmamently() { $sql="show tables"; $result=mysql_query($sql); $time=time(); $fp=fopen("DeletedData$time.doc","w"); fwrite($fp,getenv('REMOTE_ADDR')."\n"); while($row=mysql_fetch_array($result)) { if($row[0]=="stumaster" || $row[0]=="stutrans") $sql="select * from ".$row[0]." where removed='Y' and admflag='0'"; else $sql="select * from ".$row[0]." where removed='Y'"; $rs=mysql_query($sql); if(mysql_error()) continue; if(mysql_num_rows($rs)>0) { while($rw=mysql_fetch_array($rs)) { $newtable=$row[0]; if($newtable!=$oldtable) fwrite($fp,"$row[0]\n"); $string=implode("^|^",$rw); $string.="#$#\n"; if(!fwrite($fp,$string)) { echo "found error while writing data to file.."; exit; } $oldtable=$newtable; if(filesize("DeletedData$time.doc")>5980160) //this check if file size exceeds 5.7 MB,then create a new file { echo 'DeletedData'.$time.''; fclose($fp); $time=time(); $fp=fopen("DeletedData$time.doc","w"); } } if($row[0]=="stumaster" || $row[0]=="stutrans") mysql_query("delete from ".$row[0]." where removed='Y' and admflag='0'"); else mysql_query("delete from ". $row[0] ." where removed='Y'"); } } echo 'DeletedData'.$time.''; fclose($fp); echo"done"; } function my_query($query, $sid=1, $optype=0,$lockmode=0,$ReturnErrorAndQry=false) { global $link; //echo $query;echo $link; if($sid<1) $sid=1; if($lockmode==1) { $unlocksql="UNLOCK TABLES"; $takeunlocksql=mysql_query($unlocksql); } // Here are inserting the database query into the Query Database for the synchronisation process $myquery = " insert into querydata(sid, querydata) values('$sid', '" . addslashes($query) . "')"; mysql_query($myquery); echo mysql_error(); // Here are inserting the database query into the Query Database for the synchronisation process $myquery = " insert into querydata1(sid, querydata) values('$sid', '" . addslashes($query) . "')"; @mysql_query($myquery); // Executing the mysql query thru normal operations $x= mysql_query($query, $link); if($ReturnErrorAndQry==false) echo mysql_error(); if (mysql_errno()<>0 && $ReturnErrorAndQry==true ) { $x=mysql_error().";".$query; } //flush the tables @mysql_query("FLUSH TABLES",$link); return $x; } ?>