Fri Aug 12, 2011 1:00 pm
<script>
function fundel(sno)
{
rv=confirm("u want to delete");
if(rv==true)
{
location="delete.php?seno="+sno;
}
}
</script>
<form method="post" action="delrec.php">
<table border='1'>
<?php
mysql_connect("localhost","root","");
mysql_select_db("test");
$data=mysql_query("select * from emp");
while($rec=mysql_fetch_row($data))
{
echo"<tr><td><input type='checkbox' name=$rec[2]'
value='$rec[2]'><td>$rec[0]<td>$rec[1]<td>$rec[2]<td><input type='button' value='delete'
onclick='fundel($rec[2])'>";
}
?>
</table>
<input type='submit' value='delrec'>
</form>
/*<?php
$qs=$_REQUEST['seno'];
mysql_connect("localhost","root","");
mysql_select_db("test");
mysql_query("delete from emp where sno=$qs");
header(location:getrec.php");
?>*/
<script>
function delrec(sno)
{
rv=confirm("u want to delete");
if(rv==true)
{
location="delete.php?seno="+sno;
}
}
</script>
<?php
$qs=$_REQUEST['seno'];
mysql_connect("localhost","root","");
mysql_select_db("test");
mysql_query("delete from emp where sno=$qs");
header("location:getrec.php");
?>
/*<script>
function delrec(sno)
{
rv=confirm("u want to delete");
if(rv==true)
{
location="delete.php?seno="+sno;
}
}
</script>
*/
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="ins.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td colspan="3"><strong>Insert Data Into mySQL Database </strong></td>
</tr>
<tr>
<td width="71">Name</td>
<td width="6">:</td>
<td width="301"><input name="name" type="text" id="name"></td>
</tr>
<tr>
<td>Lastname</td>
<td>:</td>
<td><input name="lastname" type="text" id="lastname"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<?php
/*$host="localhost"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="test_mysql"; // Table name*/
// Connect to server and select database.
mysql_connect("localhost", "root", "")or die("cannot connect");
mysql_select_db("test")or die("cannot select DB");
// Get values from form
$empno=$_POST['empno'];
$empname=$_POST['empname'];
$desig=$_POST['desig'];
// Insert data into mysql
$sql="INSERT INTO emp(empno, empname, desig)VALUES('$empno', '$empname', '$desig')";
$result=mysql_query($sql);
// if successfully insert data into database, displays message "Successful".
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='insert.php'>Back to main page</a>";
}
else
{
echo "ERROR";
}
// close connection
mysql_close();
?>
Fri Aug 12, 2011 5:11 pm
<input type="hidden" name="param1" value="update" />
|
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.