Monday 24 November, 2008

this is the sported file nn.php for rajinder

< ?php
$dbhost="localhost";
$dbuser="root";
$dbpass="123";
//$nm=$_POST['n1'];
//$roll=$_POST['n2'];
//$class=$_POST['n3'];
$result=mysql_connect($dbhost,$dbuser,$dbpass);
$db=mysql_select_db( " student");
$rs=mysql_query("select * from info");
Print " < table border cellpadding=3>";
print ' NameRoll_NoClass';
while($info = mysql_fetch_array( $rs ))
{
Print " < tr>";
Print " < td>".$info['name'] ." < /td> ";
Print " < td>".$info['roll_no'] . " < /td> ";
Print " < td>".$info['class'] ." < /td> ";
}
Print " < /table>";

? >


This is the second file rajinder first use abc.html which is posted earlier
now use this file save it in nn.html format

remember to have student database
and
info table
in ur database

This is for rajinder

< html >
< head >
< title >
Php My Sql connectivity
< /title >
< /head>
< form action="nn.php" method="post">
< table border=2>
< tr>
< td>
< strong>name::< /strong>< /td>< td> < input type="text" name="n1">< /td>< tr> < td>
< strong>Age    ::< /strong>
< /td>< td>< input type="text" name="n2">< /td>
< tr>< td>Roll_No::< /td>< td>
< input type="text" name="n3">< /td>
< /tr>< tr>
< td colspan=2>
< input type="submit" >
< td>
< /tr>
< /table>
< /form>
< /html>

simple html page22

plz ignore spaces then type for example <> is having spaces remove them while using it rest works perfect
<>
<>
<>
This is a head
< /title >
< /head >


< /html >

mysqlphp







name::
Age ::
Roll_No::




this page is used to enter data
like name age etc. for this u should have database and concerned table in mysql

Few sql commands

some usefull mysql commands---------------------------------------
1)help( \?) synonym for help.
2) clear (\c) clear command.
3)connect(\r) reconnect to the server. Optional arguments are db and host.
4)ego (\g) send command to mysql server ,display result vertically.
5)exit (\q) same as quit Exit mysql;
6)go (\g) Send command to mysql server.
7)help (\h) Display this help.
8)notee (\t) Don't write into outfile.
9)print (\p) Print current command.
10)prompt (\R) Change your mysql promptfor example :
mysql>prompt miseeql;
Result miseeql>
11)Status get status from the server.
12)use (\u) use another database.Takes database name as argument.
13)Warnings (\W) show warnings after statement.
14)nowarning (\w) Don't show warnings after every statements.

php program to create table insert data and show data in tabular format

< ? php

$dbhost="localhost";

$dbname="root";

$dbpass="123";

$rs=mysql_connect($dbhost,$dbname,$dbpass);

$nm=$_POST['n1'];$rl=$_POST['n2'];

//This is to check whether connection established or not

//if($rs)

//echo "Connected ";

//else

//echo "Not Connected";

$ds=mysql_select_db(test);

//This is to check whether database connected or not

//if($ds)

//echo "connected to database";

//else

///echo "Not connected to database";$ts=mysql_query("create table student (name varchar(50),roll_no int(10))");

//this is to check whether query run successfully or notif($ts)echo "Table is created";

//else

//echo "Table is not created";

$is=mysql_query("insert into student values('$nm',$rl)");

//This is to check the execution of Insert Command

//if($is)

//echo "Insert is working";

//else

//echo "Insert is not working"; $sl=mysql_query("select * from student");

print '<.table border=2 color="red">';

print '<.th> Name<.th>Roll_No';

print '<.tr>';

while($info=mysql_fetch_array($sl))

{

print '<.td> '.$info['name'].'';

print '<.td>'.$info['roll_no'].'<./td>';

print '<./tr>';

}

print '<./table>';

? >

this is a page for php

<.html><.head><.title>This is the first site<./title><./head><.body>
<.form action="create.php" method="post"><.table border="2".><.tr><.td>Name:<./td><.td><.input type="text" name="n1"><./td><.tr><.td>Roll_No:<./td><.td><.input type="text" name="n2"><./td><./tr><.tr><.td><.input type="submit"><./td><./tr><./table><./form><./body><./html>

simple html

  1. <>
  2. <><>This is the first site< /title>< /head>
  3. <> < action="create.php" method="post">
  4. < border="2"> <> <>Name:< /td >
  5. <>
  6. < type="text" name="n1">
  7. < /td > <>
  8. <>Roll_No:< /td >
  9. <>
  10. < type="text" name="n2">< /td>
  11. < /tr><>
  12. < type="submit">< /td>< /tr>< /table>< /form>< /body>
  13. < /html>

simple html for php

<>
<>
<>
This is the first site
< /title>
< /head>
<>

< action="create.php" method="post">
< border="2">
<>
<>
Name:
< /td>
<>
< type="text" name="n1">
< /td>
<>
<>
Roll_No:
< /td>
<>
< type="text" name="n2">
< /td>
< /tr>
<>
<>
< type="submit">
< /td>
< /tr>
< /table>
< /form>
< /body>
< /html>