Thursday, 31 July 2014

insert code in php

<?php
$con=mysql_connect('localhost','root','') or die('not suseesful');

$db=mysql_select_db('exam') or die('not database connect');


if($db)
{
    echo "database connected";
}
echo '<br>';
$a='raja';
$b='raja';

//$sql="insert into login(uname,upass) values('$a','$b')";
 // $sql="update login set uname='mitul',upass='123' where u_id='2'";
//echo $sql="delete from login where u_id='1'";
$sql="select *from login";
$exc=mysql_query($sql) or die('not delete');
echo "<table border='1'><tr><th>ID</th><th>user name</th><th>password</th></tr><tr>";

while($row=mysql_fetch_array($exc))
{
    echo "<td>".$row['u_id']."</td>";
    echo "<td>".$row['uname']."</td>";
    echo "<td>".$row['upass']."</td></tr>";
   
   
}


?>

2 comments: