Wednesday, May 30, 2007

Integrate DATE AND TIME PICKER to textbox


<script language = 'javascript' src = 'datetimepicker.js'></script>


<tr>

<td width="15%">&nbsp;</td>

<Td width="20%" class="content_font">Date</td>

<td >

<input type="text" id="date" size=25 name="date" class="content_font" readonly>&nbsp;

<a href="javascript:NewCal('date','yyyymmdd',true,24)" class="content_font"><img src='../images/cal.gif' border='0'></a>



</td>

</tr>


above date and time picker script is u can download from this site

http://www.rainforestnet.com/download/mydatetimepicker/sample.zip

and intigrated as given above and look like that

Friday, May 25, 2007

Read xml file using simplexml functions in PHP

first you have to create xml file


<ReportData>

<Record>

<CCode>client 2</CCode>

<DESTINATION>USA</DESTINATION>

<AIRWAYBILL>A222</AIRWAYBILL>

<AWB>AQ222</AWB>

<SUB>

<DATE>5/21/2007</DATE>

<TIME>12:24:04 PM</TIME>

</SUB>

</Record>



<Record>

<CCode>client 2</CCode>

<DESTINATION>USA</DESTINATION>

<AIRWAYBILL>A222</AIRWAYBILL>

<AWB>AQ222</AWB>

<SUB>

<DATE>5/21/2007</DATE>

<TIME>12:24:04 PM</TIME>

</SUB>

</Record>



<Record>

<CCode>client 2</CCode>

<DESTINATION>USA</DESTINATION>

<AIRWAYBILL>A222</AIRWAYBILL>

<AWB>AQ222</AWB>

<SUB>

<DATE>5/21/2007</DATE>

<TIME>12:24:04 PM</TIME>

</SUB>

</Record>

</ReportData>


now user this code for parsing read in with simplexml functions


 


if(!$xml=simplexml_load_file('report.xml'))

{

trigger_error('Error reading XML file',E_USER_ERROR);

echo "file loaded";

}

echo 'Displaying contents of XML file...<br />';

foreach($xml as $records){

echo '<B>CLINET CODE: </b>'.$records->CCode.'<B> DESTINATION: <b>'.$records->DESTINATION.'

<B>AIRWAY BILL: </b>'.$records->AIRWAYBILL.'<br />';

}


run it this will display result of cccode and destination and airwaybill

Tuesday, May 22, 2007

Read xml file using DOM in PHP

<ReportData>

<Record>

<CCode>client 2</CCode>

<DESTINATION>USA</DESTINATION>

<AIRWAYBILL>A222</AIRWAYBILL>

<AWB>AQ222</AWB>

<SUB>

<DATE>5/21/2007</DATE>

<TIME>12:24:04 PM</TIME>

</SUB>

</Record>

</ReportData>


save above as report.xml file and than


run below script its script using dom how


you can read data from an xml file


 


<?php

$doc = new DOMDocument();

$doc->load( 'report.xml' );



$Record = $doc->getElementsByTagName( "Record" );

foreach( $Record as $rec )

{

$ccode = $rec->getElementsByTagName( "CCode" );

$ccode= $ccode->item(0)->nodeValue;



$destination = $rec->getElementsByTagName("DESTINATION");

$destination = $destination->item(0)->nodeValue;



$airwaybill = $rec->getElementsByTagName("AIRWAYBILL");

$airwaybill = $airwaybill->item(0)->nodeValue;



$awb = $rec->getElementsByTagName("AWB");

$awb = $awb->item(0)->nodeValue;



$SUB = $rec->getElementsByTagName( "SUB" );

$SUB = $SUB->item(0)->nodeValue;





$date = $rec->getElementsByTagName( "DATE" );

$date = $date->item(0)->nodeValue;

$time = $rec->getElementsByTagName( "TIME" );

$time = $time->item(0)->nodeValue;



echo "$ccode - $destination - $airwaybill - $awb - $SUB - $date - $time <BR>";

}

?>

Monday, May 21, 2007

connect with ms-access and print the table of data in php

<?php

$db_conn = new COM("ADODB.Connection");

$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". realpath("thedata.mdb").";";

$db_conn->open($connstr);

if($db_conn)

{

echo "connected";

}

else

{

echo "not conected";

}

$rS = $db_conn->execute("SELECT * FROM main1");


$cnt=0;

echo"<table>";

while (!$rS->EOF)

{



if($cnt%2 == 0 )

{

print "<tr bgcolor='#C0C0C0'><td>".$rS->Fields(0)."</td><td>". $rS->Fields(1)."</td><td>".$rS->Fields(2)."</td><td>".$rS->Fields(3)."</td><td>".$rS->Fields(4)."</td><td> ".$rS->Fields(5)."</td><td>".$rS->Fields(6)."</td></tr>\n";

}

else

{

print "<tr><td>".$rS->Fields(0)."</td><td>". $rS->Fields(1)."</td><td>".$rS->Fields(2)."</td><td>".$rS->Fields(3)."</td><td>".$rS->Fields(4)."</td><td> ".$rS->Fields(5)."</td><td>".$rS->Fields(6)."</td></tr>\n";

}

$cnt++;

$rS->MoveNext();

}

echo"</table>";

$rS->Close();

$db_conn->Close();

?>



its eassy that you have to just change your database name for run this script