NinethSense oWnZ mE!: Praveen’s drawing book

Choose a Topic:

Fri
31
Mar '06

Ajax simpleeee….

Here is my simple ajax code…..

 
<div id=“divTxt”>&nbsp;</div>
 
<script language=“javascript”>
	var req = new XMLHttpRequest();
	req.open(“GET”, “test.html”,true);
	req.onreadystatechange = function () {
		document.getElementById(‘divTxt’).innerHTML = “Contents : “ + req.responseText;
	}
 
	req.send(null);
 
</script>
 
HTML Source - test.html
 
<html>
	<head>
		<meta http-equiv=“content-type” content=“text/html; charset=UTF-8″>
	</meta></head>
	<body>
		apple<br />
		orange<br />
		pencil<br />
		box<br />
		bottle<br />
		computer<br />
		cat<br />
		dog<br />
		fox<br />
		windows<br />
		linux<br />
		unix<br />
		freebsd<br />
		blah<br />
	</body>
</html>
 
This code is compatible with Mozilla based browsers only. Eg: Firefox for windows
Thu
23
Mar '06

Get all table names from Microsoft Access (MDB) database file

 
con.Open();
DataTable dt = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] {null, null, null, “TABLE”});
 
for (int i=0;i< dt.Rows.Count;i++)
{
	MessageBox.Show( dt.Rows[i][“TABLE_NAME”].ToString());
}
con.Close();
Tue
21
Mar '06

Simple Paging feature with PHP and MySQL

This is not a full-featured code, but you can develop it to one.
Simple Paging feature with PHP and MySQL
 
< _?php
	$db = mysql_connect(“localhost”,“root”);
	mysql_select_db(“test”);
 
	$pagesize = 2;
	$res = mysql_query(“select *from test”);
	$totalrecs = mysql_num_rows($res);
	if (!isset($firstrec)) $firstrec = 0;	
	if 	(isset($_REQUEST[‘action’])) {
		$firstrec = $_REQUEST[‘firstrec’];
		switch ($_REQUEST[‘action’]) {
			case “prev”: 
				if ($firstrec > 0)
					$firstrec-= $pagesize ; 
				break;
			case “next”: 
				if ($firstrec < $totalrecs-$pagesize ) 
					$firstrec+=$pagesize; 
				break;
		}
	}
 
	$res = mysql_query(“select *from test limit “ . $firstrec . “, “ . $pagesize);
	
	while ($row = mysql_fetch_assoc($res)) {
		echo “<br>” . $row[“id”] . ” “ . $row[“name”];
	}
?>
<br /><br />
<table width=“475″ border=“1″>
  <tr>
    <td width=“60″><a href=“/index.php?firstrec=< ?=$firstrec ?>&action=prev”>Prev</a></td>
    <td width=“327″ align=“center”>
< _?php
		$res = mysql_query(“select *from test”);
		for ($i=0;$i< (mysql_num_rows($res)/$pagesize);$i++) {
			if ($firstrec== $i*$pagesize) 
				echo “<b>” . $i . ” | “ ;
			else
				echo “<a href=’”.$_SERVER[‘PHP_SELF’].“?firstrec=” . ($i*$pagesize) .“&action=number’>$i</a> | “ ; 
		}
?>		
	</td>
    <td width=“66″><a href=“/index.php?firstrec=< ?=$firstrec ?>&action=next”>Next</a></td>
  </tr>
</table>
Thu
9
Mar '06

Return multiple values from a function

 
private void test(out string test1, out string test2) 
{
	test1 = “hello”;
	test2 = “world”;
}
 
 
 
test(out a, out b);
Text = a + ” “ + b;
 
Sun
5
Mar '06

Sorry, I will be back soon.

I am too busy with some projects now. So not getting time to update my blog.
Sure, I will come back soon.
The CodeProject Microsoft Developer Network Official ASP.NET Forums Microsoft .NET Framework Community Microsoft Most Valuable Professional Kidoos forums Microsoft Visual Studio Developer Home Professional Information Technology Solutions Microsoft Research Home Trivandrum Microsoft Users Group Community Website