source:: http://www.dreamincode.net/forums/topic/22729-querying-a-database-ms-access/
Friday, August 6, 2010
Monday, July 26, 2010
How to embed flash swf in php??
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="161">
<param name="movie" value="images/header.swf" />
<param name="quality" value="high" />
<embed src="images/header.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="161"></embed>
</object>
Code for embedding flash movie files(swf) in php.
1: <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="161">
2: <param name="movie" value="images/header.swf" />
3: <param name="quality" value="high" />
4: <embed src="images/header.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="161"></embed>
5: </object>
Sunday, July 25, 2010
Database handling in php.
first open phpmyadmin and then create a new database named “test”( for the specific purpose of this example).
now create a table inside it named “counter” with a field “count” in it. ( integer,NULL,unsigned)
Now, create a file named server_auth.php in (root)/config folder. this folder you must remove all accessing permissions.
in server_auth.php
<?php
$db_host = "localhost";
$db_user = "root";
$db_password = "";
$db_name = "test";
?>
create another file in your webroot named “ counter.php”
<?php
require($_SERVER["DOCUMENT_ROOT"]."/config/server_auth.php");
$connection = @mysql_connect($db_host,$db_user,$db_password) or die("error connecting the database!");
mysql_select_db($db_name, $connection);
$query = "SELECT * FROM counter";
$result = mysql_query($query, $connection) or die(mysql_error());
$views = mysql_result($result, 0, "count");
$views++;
$query = "UPDATE counter SET count = $views";
mysql_query($query, $connection) or die(mysql_error());
echo "This page has been viewed ".$views. " times.";
?>
ALL DONE! just open that counter.php in your browser and it will display a hit count!
Friday, June 4, 2010
Connecting to Database by writing code in VB.NET (Widout wizard)
Step 1. Add reference to system.data in your code
Click project->Add Reference
Select .Net tab
Select System.Data
Now click Ok.
Step 2. before Public Class Form1, write
Imports System.Data
Step 3. In Form load event
Dim Con As new OleDb.OleDbConnection
Step 4. Now write next
Con.Connectionstring=”PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=c:\mydatabase.mdb”
End Sub
Step 5. Open the connection to database with
Con.Open()
and display a msgbox to test the successful connection
msgbox(“the connection is opened”)
Step 6. Create new dataset and data adapter.
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Step 7. Pass new sql query to the data adapter
Dim sql As String
sql=”SELECT * FROM mydatabasetable1”
da=New OleDb.OleDbDataAdapter(sql,con)
This is how your Code should look like
Finally Fill the dataset with data.
da.Fill(ds,”mybase”)
This connects the database to dataset and fills it. Just that the data can’t be seen till now by anyone since it is not binded to any user viewable control.
txtFirstName.Text = ds.Tables("mydatabasetable").Rows(0).Item(1)
for further reading…http://www.homeandlearn.co.uk/NET/nets12p6.html
Final sample code::::::
| Private Sub Frmmain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim conn As New OleDb.OleDbConnection |
Wednesday, June 2, 2010
How to keep the background image static and let the whole fore-page scroll???
This is done using CSS and is very simple indeed!
here is the code
<center>
<body style=
"background-image: url('http://img.inkfrog.com/pix/KeepingBusy/BGinterlocksmall.gif'); background-repeat; background-position: 0px 50%; background-attachment: fixed">
<table border="0" width="650">
<tr>
<td width="100%" HEIGTH="600">
<table border="0" width="100%" cellspacing="0" cellpadding="0"
bgcolor="WHITE">
<tr>
<td width="100%">
<CENTER>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
X<br>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</center>
Printing a document in dot net.
printdialog1.document=printdocument1
printdialog1.printersettings=printdocument1.printersettings
printerdialog1.allowsomepages=true
if printdualog.showdialog=dialogresult.OK then
printdocumet1.printersettings=printdialog1.printersettings
printdocument1.print()
End if
For print preview button!
printpreviewdialog1.document=printdocument1
printpreviewdialog1.showdialog()
