Wednesday, December 31, 2008

How to install oracle developer in vista

http://jithendra-g.blogspot.com/2008/04/installing-oracle-developer-suite-10g.html

Monday, December 29, 2008

change virtual memory in vista

Navigation-> Right Click My computer -> Properties -> Advanced system Settings -> Under Performance, click on settings -> Under advanced tab, under Virtual Memory click on Change

scrolling news in runcms

global $db;
$table=$db->prefix("topics");
$rt= new XoopsTopic($table,0);
$topics=$rt->getAllChildTopics();
?>




foreach($topics as $topic)
{
echo $topic->topic_title;
}
?>

Saturday, December 27, 2008

How to print result in oracle console


  set serveroutput ON;
DBMS_OUTPUT.PUT_LINE('some val')

sequence(Oracle) Alternate to auto_increment(mysql)


   create a sequence
 create sequence test_d_seq  increment by 1 START WITH 1;
  insert value
insert into test_d values(test_d_seq.NEXTVAL,'Gex');

Thursday, December 25, 2008

treeview in oracle

select LEVEL,ID,NAME,REPORT_TO
from top_dogs
START WITH report_to IS NULL
CONNECT BY PRIOR id=report_to

select LPAD(NAME,length(NAME)+LEVEL*2,'_')
from top_dogs
START WITH report_to IS NULL
CONNECT BY PRIOR id=report_to

Monday, December 22, 2008

top-n Analysis in oracle

select * from (select * from top_dogs order by salary DESC)where ROWNUM<=3
top 3 salary earners

Saturday, December 20, 2008

Drag and drop Menu using Tool-man+php

Drag  and drop Menu using Tool-man+php



1) Download tool-man new version(http://tool-man.org)



2) Edit tool-man\source\org\tool-man\core.js

     modify function inspectListOrder in ToolMan._junkdrawer

   



inspectListOrder_ret : function(id) {

        return(ToolMan.junkdrawer().serializeList(document.getElementById(id)))

    },



3)Modify sorting.html





<link rel="stylesheet" type="text/css" href="../../tool-man/examples/common/common.css"/>

<link rel="stylesheet" type="text/css" href="../../tool-man/examples/common/lists.css"/>

<style type="text/css"><!--

    ul.boxy li { margin: 0px; }

    #phonetics td {

        margin: 0px;

        padding: 0px 1em;

        vertical-align: top;

        width: 100px;

    }

   

   

   

   

    //-->

</style>



<script language="JavaScript" type="text/javascript" src="../../tool-man/source/org/tool-man/core.js"></script>

<script language="JavaScript" type="text/javascript" src="../../tool-man/source/org/tool-man/events.js"></script>

<script language="JavaScript" type="text/javascript" src="../../tool-man/source/org/tool-man/css.js"></script>

<script language="JavaScript" type="text/javascript" src="../../tool-man/source/org/tool-man/coordinates.js"></script>

<script language="JavaScript" type="text/javascript" src="../../tool-man/source/org/tool-man/drag.js"></script>

<script language="JavaScript" type="text/javascript" src="../../tool-man/source/org/tool-man/dragsort.js"></script>

<script language="JavaScript" type="text/javascript" src="../../tool-man/source/org/tool-man/cookies.js"></script>



<script language="JavaScript" type="text/javascript"><!--

    var dragsort = ToolMan.dragsort()

    var junkdrawer = ToolMan.junkdrawer()



    window.onload = function() {

        junkdrawer.restoreListOrder("numeric")

        junkdrawer.restoreListOrder("phonetic1")

        junkdrawer.restoreListOrder("phonetic2")

        junkdrawer.restoreListOrder("phonetic3")

       

        dragsort.makeListSortable(document.getElementById("numeric"),

                verticalOnly, saveOrder)



        dragsort.makeListSortable(document.getElementById("phonetic1"),

                verticalOnly, saveOrder)

        dragsort.makeListSortable(document.getElementById("phonetic2"),

                verticalOnly, saveOrder)

        dragsort.makeListSortable(document.getElementById("phonetic3"),

                verticalOnly, saveOrder)

    }



    function verticalOnly(item) {

        item.toolManDragGroup.verticalOnly()

    }



    function speak(id, what) {

        var element = document.getElementById(id);

        element.innerHTML = 'Clicked ' + what;

    }



    function saveOrder(item) {

        var group = item.toolManDragGroup

        var list = group.element.parentNode

        var id = list.getAttribute("id")

        if (id == null) return

        group.register('dragend', function() {

            ToolMan.cookies().set("list-" + id,

                    junkdrawer.serializeList(list), 365)

        })

    }



    //-->

</script>



4) write the code for list menu item



<ul id="numeric">

    </ul>



<?

$sql_t="SELECT *  FROM  $table_t

WHERE `position` = 'right' order by `order`";

$rest=$db->query($sql_t);

?>

<table id="phonetics">

    <tr>

        <td>

            <ul id="phonetic1" class="boxy">

  <?         

            while($arr=$db->fetch_array($rest))

            {

    ?>       

    <li id="<?=$arr[id]?>"><div align="right"><?= $arr[name]?></div></li>';

                   

<?   

                        }

?>           

   </ul>        

           

<form method="post" action="menu_save.php" name="save_form">

<input type="hidden" name="ord" id="ord" />

<input type="hidden" name="action" value="menu_order"/>

<input type="button" value="íÑÓá" onClick="javascript:save_menu()" />

</form>

5)write save menu  function

      <script language="javascript" type="text/javascript">

function save_menu()

{

var sd=junkdrawer.inspectListOrder_ret('phonetic1');

//alert(sd);

var control = document.getElementById("ord");

control.value=sd;

//document.save_form.action="http://localhost/search.php?s="+sd.toString();

document.save_form.submit();



}

</script>

6)Process/ save the manu in php

$ord=explode("|",$_POST["ord"]);

        foreach($ord as $key=>$value)

                { $sql="UPDATE $table SET `order`=".($key+1)." where id=".$value;

                  $result=$db->query($sql);

                }

Simple PL/SQL program

SQL> VARIABLE RESULT NUMBER;
SQL> BEGIN
2 SELECT max(salary) INTO :RESULT FROM top_dogs;
3 END;
4 /

PL/SQL procedure successfully completed.

SQL> print RESULT;

RESULT
----------
250000
SQL>

Monday, November 10, 2008

Adding new User RunCMS

include_once(XOOPS_ROOT_PATH."/class/xoopsobject.php");
include_once(XOOPS_ROOT_PATH."/class/xoopsuser.php");
include_once(XOOPS_ROOT_PATH."/include/functions.php");


$name=$_REQUEST["name"];
$uname=$_REQUEST["uname"];
$passwd=$_REQUEST["passwd"];
$shapwd = rc_shatool($uname.$passwd);
$user= new XoopsUser();
$user->setVar("name", $name,true);
$user->setVar("uname", $uname,true);
$user->setVar("pass", $shapwd,true);
$user->setVar("level",1,true);
$user->store();

Monday, November 03, 2008

FCK editor integration in RunCMS

include_once(XOOPS_ROOT_PATH.'/class/fckeditor/fckeditor.php');
$runFCKeditor = new FCKeditor('content');
$runFCKeditor->BasePath = XOOPS_URL."/class/fckeditor/";

//$runFCKeditor->create();

if ($runFCKeditor->IsCompatible() && $editorConfig["displayeditor"] == 1 && $editorConfig["displayforuser"] == 1 && $xoopsUser)
{
$runFCKeditor->EchoEditArea('content', $news->hometext);
//$runFCKeditor->create();
}

How get Topics IN RunCMS

global $db;
$table=$db->prefix("topics");
$rt= new XoopsTopic($table,0);
$topics=$rt->getAllChildTopics();
foreach($topics as $topic)
{
echo $topic->topic_id;
echo $topic->topic_title;
}

Sunday, November 02, 2008

Monday, August 25, 2008

News Followed by date in Runcms

calender
<script>
var ns6=document.getElementById&&!document.all;
var ie4=document.all;

var Selected_Month;
var Selected_Year;
var Current_Date = new Date();
var compare_Date = new Date();
var Current_Month = Current_Date.getMonth();

var Days_in_Month = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var Month_Label = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');

var Current_Year = Current_Date.getYear();
if (Current_Year < 1000)
Current_Year+=1900;


var Today = Current_Date.getDate();

function Header(Year, Month) {

if (Month == 1) {
Days_in_Month[1] = ((Year % 400 == 0) || ((Year % 4 == 0) && (Year % 100 !=0))) ? 29 : 28;
}
var Header_String = Month_Label[Month] + ' ' + Year;
return Header_String;
}


function selectDate(mo, day, yr)
{
//alert(mo+day+yr);
date =yr;
if(mo < 10)
{
date += '0'+mo;
}
else
{
date += ''+mo;
}
if(day < 10)
{
date += '0'+day ;
}
else
{
date += ''+day ;
}
//alert(date);
window.location= '{X_SITEURL}/modules/news/day_archive.php?date='+date;

//return false;
}


function Make_Calendar(Year, Month) {
var First_Date = new Date(Year, Month, 1);
var Heading = Header(Year, Month);
var First_Day = First_Date.getDay() + 1;
if (((Days_in_Month[Month] == 31) && (First_Day >= 6)) ||
((Days_in_Month[Month] == 30) && (First_Day == 7))) {
var Rows = 6;
}
else if ((Days_in_Month[Month] == 28) && (First_Day == 1)) {
var Rows = 4;
}
else {
var Rows = 5;
}

var HTML_String = '<div align="left"><table border="1" id="table1" bordercolor="#7B9EBD" cellspacing="0" cellpadding="2"><tr><td align="center">';
HTML_String += '<table border="1" width="160" celpadding="0" cellspacing="0" bordercolorlight="#E0E0E0" bordercolordark="#E0E0E0"><tr>';
HTML_String += '<td width="18" align="right"><b><a style="cursor:hand" onClick="Skip(\'-\')">';
HTML_String += '<font face="Courier" size="2" color="#6C7EAA"><span style="text-decoration: none"><<</span></font></a></b></td>';
HTML_String += '<td width="110" align="center"><b><font face="Arial" size="2">'+ Heading +'</font></b></td>';
HTML_String += '<td width="4" align="left"><b><a style="cursor:hand" onClick="Skip(\'+\')"> <font face="Courier" size="2" color="#6C7EAA">';
HTML_String += '<span style="text-decoration: none">>></span></font></a></b></td></tr></table>';
HTML_String += '<table border="0" width="0" bordercolorlight="#C0C0C0" bordercolordark="#808080" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0">';
HTML_String += '<td width="100%"><table border="1" width="160" bordercolorlight="#E0E0E0" bordercolordark="#E0E0E0" style="border-collapse: collapse" bordercolor="#000000" cellpadding="0" cellspacing="0" bgcolor="#EEEEEE">';
HTML_String += '<tr><td width="20" align="center" nowrap bordercolor="#666666" bgcolor="#F7F9FB" bordercolorlight="#E0E0E0" bordercolordark="#E0E0E0">';
HTML_String += '<font color="#666666" face="Verdana" size="2">Su</font></td>';
HTML_String += '<td width="20" align="center" nowrap bordercolor="#666666" bgcolor="#F7F9FB" bordercolorlight="#E0E0E0" bordercolordark="#E0E0E0">';
HTML_String += '<font color="#666666" face="Verdana" size="2">Mo</font></td>';
HTML_String += '<td width="20" align="center" nowrap bordercolor="#666666" bgcolor="#F7F9FB" bordercolorlight="#E0E0E0" bordercolordark="#E0E0E0">';
HTML_String += '<font color="#666666" face="Verdana" size="2">Tu</font></td>';
HTML_String += '<td width="20" align="center" nowrap bordercolor="#666666" bgcolor="#F7F9FB" bordercolorlight="#E0E0E0" bordercolordark="#E0E0E0">';
HTML_String += '<font face="Verdana" size="2" color="#666666">We</font></td>';
HTML_String += '<td width="20" align="center" nowrap bordercolor="#666666" bgcolor="#F7F9FB" bordercolorlight="#E0E0E0" bordercolordark="#E0E0E0">';
HTML_String += '<font color="#666666" face="Verdana" size="2">Th</font></td>';
HTML_String += '<td width="20" align="center" nowrap bordercolor="#666666" bgcolor="#F7F9FB" bordercolorlight="#E0E0E0" bordercolordark="#E0E0E0">';
HTML_String += '<font color="#666666" face="Verdana" size="2">Fr</font></td>';
HTML_String += '<td width="20" align="center" nowrap bordercolor="#666666" bgcolor="#F7F9FB" bordercolorlight="#E0E0E0" bordercolordark="#E0E0E0">';
HTML_String += '<font color="#666666" face="Verdana" size="2">Sa</font></td></tr>';


var Day_Counter = 1;
var Loop_Counter = 1;
for (var j = 1; j <= Rows; j++) {
HTML_String += '<tr ALIGN="left" VALIGN="top">';
for (var i = 1; i < 8; i++) {
if ((Loop_Counter >= First_Day) && (Day_Counter <= Days_in_Month[Month])) {
//= new Date();
compare_Date.setDate(Day_Counter);
compare_Date.setMonth(Month );
compare_Date.setFullYear(Year );

if(Current_Date > compare_Date)
{
HTML_String += ' <td bgcolor ="#ffffff" width="10" align="center" height="10" valign="top">';
HTML_String += '<a href=javascript: onclick="selectDate(\''+(Month+1) +'\',\''+Day_Counter+'\',\''+Year+'\')" style="cursor:hand;text-decoration: none;">';
HTML_String += '<font color="003DB8" face="Verdana" size="2">' + Day_Counter + '</font></a></font></td>';


}
else
{
if((Day_Counter == Today) && (Year == Current_Year) && (Month == Current_Month))
{
//alert(Current_Date)
HTML_String += ' <td bgcolor ="#6C7EAA" width="10" align="center" height="10" valign="top">';
HTML_String += '<a href="#" onclick="selectDate(\''+(Month+1) +'\',\''+Day_Counter+'\',\''+Year+'\')" style="cursor:hand;text-decoration: none;">';
HTML_String += '<font color="#ffffff" face="Verdana" size="2">' + Day_Counter + '</font></a></font></td>';


}
else
{
HTML_String += '<td bgcolor ="#ffffff" width="10" align="center" height="10" valign="top"><font color="#808080" face="Verdana" size="2">' + Day_Counter + '</font></a></td>';
}
}
/*if ((Day_Counter == Today) && (Year == Current_Year) && (Month == Current_Month)) {

}
else {

}*/
Day_Counter++;
}
else {
HTML_String += '<td BORDERCOLOR="C0C0C0"> </td>';
}
Loop_Counter++;
}
HTML_String += '</tr>';
}
HTML_String += '</table></td></tr></table>';
cross_el=ns6? document.getElementById("Calendar") : document.all.Calendar;
cross_el.innerHTML = HTML_String;
}


function Check_Nums() {
if ((event.keyCode < 48) || (event.keyCode > 57)) {
return false;
}
}



function On_Year() {
var Year = document.when.year.value;
if (Year.length == 4) {
Selected_Month = document.when.month.selectedIndex;
Selected_Year = Year;
Make_Calendar(Selected_Year, Selected_Month);
}
}

function On_Month() {
var Year = document.when.year.value;
if (Year.length == 4) {
Selected_Month = document.when.month.selectedIndex;
Selected_Year = Year;
Make_Calendar(Selected_Year, Selected_Month);
}
else {
alert('Please enter a valid year.');
document.when.year.focus();
}
}


function Defaults() {
if (!ie4&&!ns6)
return
var Mid_Screen = Math.round(document.body.clientWidth / 2);
//document.when.month.selectedIndex = Current_Month;
//document.when.year.value = Current_Year;
Selected_Month = Current_Month;
Selected_Year = Current_Year;
Make_Calendar(Current_Year, Current_Month);
}


function Skip(Direction) {
if (Direction == '+') {
if (Selected_Month == 11) {
Selected_Month = 0;
Selected_Year++;
}
else {
Selected_Month++;
}
}
else {
if (Selected_Month == 0) {
Selected_Month = 11;
Selected_Year--;
}
else {
Selected_Month--;
}
}
Make_Calendar(Selected_Year, Selected_Month);
//document.when.month.selectedIndex = Selected_Month;
//document.when.year.value = Selected_Year;
}

function onload_activities()
{
Defaults();

}
window.onload = onload_activities;
/*Ends Calendar*/

</script>


<table id="table1" style="border-collapse: collapse;" width="154" border="1" bordercolor="#c0c0c0">
<tbody><tr>
<td valign="top">
<div id="Calendar" align="left">

</div></td>
</tr>
</tbody></table>
-----------------------------------------------------------------------------------
day_archive.php
<?
include_once("header.php");

$count = 0;

$lastyear = "0000";
$lastmonth = "00";

$date = $_REQUEST['date'];

$fromyear = (int)substr($date,0,4);
$frommonth = (int)substr($date,4,2);
$fromdate= (int)substr($date,6,2);
#echo $fromyear."/".$frommonth."/".$fromdate;

$current_title = _NW_NEWSARCHIVES;


if($fromyear)
{
$current_month = rc_cal_month_get_by_number($frommonth).", $fromyear";
$current_title = " $fromdate,$current_month : "._NW_NEWSARCHIVES;
}


$meta['title'] = "$current_title : ".$meta['title'];

include_once(XOOPS_ROOT_PATH."/header.php");
include_once(NEWS_ROOT."/class/class.newsstory.php");


$useroffset = "0";
if ($xoopsUser)
{
$timezone = $xoopsUser->timezone();
if (isset($timezone))
{
$useroffset = $xoopsUser->timezone();
}
else
{
$useroffset = $xoopsConfig['default_TZ'];
}
}

OpenTable();





echo "<style>#months li{ list-style-image: url(".get_module_url("images/size.gif").")}</style><h1>";

if($frommonth)
echo _NW_NEWSARCHIVES." $fromdate, $current_month";
else
echo _NW_NEWSARCHIVES;

echo "</h1>";
/*
$result=$db->query("SELECT published FROM ".NEWS_STORIES_TBL." WHERE published>0 AND published<=".time()." ORDER BY published DESC");
if (!$result)
{
echo $db->errno(). ": ".$db->error(). "<br />";
CloseTable();
include_once(XOOPS_ROOT_PATH."/footer.php");
exit();
}
else
{
echo "<ul id='months'>";
while (list($time) = $db->fetch_row($result))
{
$datetime[1] = date("Y", $time);
$datetime[2] = date("m", $time);
if (($lastyear != $datetime[1]) || ($lastmonth != $datetime[2]))
{
$lastyear = $datetime[1];
$lastmonth = $datetime[2];
echo "<li><a href='".news_url_archive($lastyear,$lastmonth)."'>".
rc_cal_month_get_by_number($lastmonth).", $lastyear</a></li>";
}
}
}

echo "</ul>";*/

if ($fromyear)
{
echo "<table border='0' cellspacing='1' cellpadding='2' width='100%' class='bg4'>";
echo "<tr><th>"._NW_TOPICC."</th><th>"._NW_ARTICLES."</th>
<th>"._NW_ACTIONS."</th>
<th>"._NW_VIEWS."</th>
<th>"._NW_COMMENTS."</th>
<th>"._NW_DATE."</th></tr>";

// must adjust the selected time to server timestamp
$timeoffset = $useroffset - $xoopsConfig['server_TZ'];
// $monthstart = mktime(0-$timeoffset,0,0,$frommonth,1,$fromyear);
// $monthend = mktime(23-$timeoffset,59,59,$frommonth+1,0,$fromyear);
// $monthend = ($monthend > time()) ? time() : $monthend;
$day_start= mktime (0 ,0,1, $frommonth ,$fromdate ,$fromyear );
$day_end=mktime (23 ,59,59, $frommonth ,$fromdate ,$fromyear );

$sql = "SELECT a.*, b.topic_id, b.topic_title FROM ".NEWS_STORIES_TBL." a LEFT JOIN ".NEWS_TOPICS_TBL." b
ON a.topicid =b.topic_id WHERE a.published > $day_start and a.published < $day_end ORDER by a.published DESC";
//echo $sql;
$result = $db->query($sql);

$bg = "bg2";

while ($myrow = $db->fetch_array($result))
{
$article = new NewsStory($myrow);
$printP = "<a href='".get_module_url("print.php?storyid=".$article->storyid())."' target='_blank'><img
src='".get_module_url("images/print.gif")."' border='0' alt='"._NW_PRINTERFRIENDLY."' width='15' height='11' /></a> ";

$sendF = "<a target='_top' href='mailto:?subject=".rawurlencode(sprintf(_NW_INTARTICLE, $meta['title']))."&body=".
rawurlencode(sprintf(_NW_INTARTFOUND, $meta['title'])).":\r\n".$article->get_url()."'><img src='".get_module_url("images/friend.gif")."' border='0' alt='"._NW_SENDSTORY."' width='15' height='11' /></a>";

$bg = ( ($bg=="bg2") ? "bg1": "bg2");

echo "<tr class='$bg'><td>".$article->textlink()."</td><td>".$article->show_title()."</td>
<td class='center'>$printP $sendF</td>
<td class='center'><small>".$article->counter()."</small></td>
<td class='center'><small>".(int)$myrow['comments']."</small></td>
<td><small>".formatTimestamp($article->published(), "s", $useroffset)."</small></td>
</tr>";
$count ++;
}
echo "</table><small>";
printf(_NW_THEREAREINTOTAL, $count);
echo "</small>";
}

CloseTable();
include_once(XOOPS_ROOT_PATH."/footer.php");




function news_url_archive($y,$m)
{
global $newsConfig;
return ($newsConfig['mod_rewrite']) ? "archive$y$m.html" : "archive.php?date=$y$m";
}
?>

how to add fav icon for your website

<link type="image/x-icon" href="url-to-favicon.ico" rel="shortcut icon"/>
<link type="image/x-icon" href="url-to-favicon.ico" rel="icon"/>

Sunday, August 17, 2008

latest 10 news article in runcms

----function defenition---
function b_t()
{
global $db, $myts;

include_once(XOOPS_ROOT_PATH."/modules/news/cfg.php");

$block = array();


// $result = $db->query("SELECT storyid, title FROM ".$db->prefix("stories")." WHERE (published > ".$tdate." AND published < ".time().") ORDER BY counter DESC", 1, 0);
$result = $db->query("SELECT `storyid`, `title` FROM ".$db->prefix("stories")." WHERE `published`!=0 order by `storyid` desc LIMIT 10");
$block['content']="<ol>";
while( $arr=$db->fetch_array($result))
{
$block['content'].="<li><a href='".news_url_story($arr["storyid"])."'>". $arr["title"]."</a></li>";
}
$block['content'].= "</ol>";
$block['title'] = _MB_NEWS_TITLE10;

//$block['content'] = news_url_story($id, $title="", 0);
/* $block['content']="<ol>";
foreach($arr as $ar)
{
$block['content'].="<li>".$ar["storyid"]."</li>";
}
$block['content'].= "</ol>";*/


return $block;
}
--xoops version.php
$modversion['blocks']["some_no"]['file'] = 'file_name.php';
$modversion['blocks']["some_no"]['name'] = _MI_NEWS_BNAME10;
$modversion['blocks']["some_no"]['description'] = 'Shows news topics';
$modversion['blocks']["some_no"]['show_func'] = 'b_t';

Sunday, August 10, 2008

add a simple page in runcms

include_once("./mainfile.php");
include_once(XOOPS_ROOT_PATH."/header.php");
-- Contents -----
include_once("footer.php");

Sunday, June 01, 2008

save ini

function save_ini($key,$value)
{
$ini_array = parse_ini_file("d.ini");
$ini_array[$key]=$value;
write_ini_file("d2.ini", $ini_array);
}

write_ini_file

function write_ini_file($path, $assoc_array) {

foreach ($assoc_array as $key => $item) {
if (is_array($item)) {
$content .= "\n[$key]\n";
foreach ($item as $key2 => $item2) {
$content .= "$key2 = \"$item2\"\n";
}
} else {
$content .= "$key = \"$item\"\n";
}
}

if (!$handle = fopen($path, 'w')) {
return false;
}
if (!fwrite($handle, $content)) {
return false;
}
fclose($handle);
return true;
}

Saturday, May 31, 2008

Simple paging in php

function prev_pg($current_page,$url)
{
for($i=1;$i<$current_page;$i++)
{
echo " ".$i."|";
}

}
function next_pg($current_page,$url,$total_set,$limits)
{
$total_pages=($total_set/$limits)+1;
for($i=$current_page;$i<=$total_pages;$i++)
{
echo " ".$i."|";
}
}


if(isset($_POST["page_no"]))
$page=$_POST["page_no"];
else
$page=1;
$start=$page-1;
$limits=10;

$sql="SELECT `*` FROM ------------- ";
$name1=mysql_query($sql);
$total_set=mysql_num_rows($name1)




$sql="SELECT -------------------- LIMIT $start ,$limits";
$name=mysql_query($sql);
$row=mysql_fetch_array($name);


prev_pg($page,"tariff.php");
next_pg($page,"tariff.php",$total_set,$limits);

Thursday, May 15, 2008

trim in java script

function LTrim( value ) {

var re = /\s*((\S+\s*)*)/;
return value.replace(re, "$1");

}

// Removes ending whitespaces
function RTrim( value ) {

var re = /((\s*\S+)*)\s*/;
return value.replace(re, "$1");

}

// Removes leading and ending whitespaces
function trim( value ) {

return LTrim(RTrim(value));

}

Wednesday, May 07, 2008

replace all occurance of particular portion

function replace(string,text,by) {
// Replaces text with by in string
var strLength = string.length, txtLength = text.length;
if ((strLength == 0) || (txtLength == 0)) return string;

var i = string.indexOf(text);
if ((!i) && (text != string.substring(0,txtLength))) return string;
if (i == -1) return string;

var newstr = string.substring(0,i) + by;

if (i+txtLength < strLength)
newstr += replace(string.substring(i+txtLength,strLength),text,by);

return newstr;
}

dict function

function dict($english)
{
$ini_array = parse_ini_file("d.ini");
return($ini_array[$english]);
}

Sunday, May 04, 2008

header for arabic html page

meta equiv="content-type" content="text/html; charset=windows-1256"
meta equiv="content-language" content="ar">

header for arabic html page

meta equiv="content-type" content="text/html; charset=windows-1256"
meta equiv="content-language" content="ar">

Print a particular div on HTML page

function CallPrint(strid){
var prtContent = document.getElementById(strid);var WinPrint =window.open('','','left=0,top=0,width=1,height=1,t oolbar=0,scrollbars=0,status=0');WinPrint.document.write(prtContent.innerHTML);WinPrint.document.close();WinPrint.focus();WinPrint.print();WinPrint.close();prtContent.innerHTML=strOldOne;}