0
<html>
<head>
<title>
Company Login 
</title>
<style>
li
{
display:inline;
}
</style>
</head>
</html>
<?php

session_start();
echo"Welcome ". $_SESSION["cname"];

$cp= $_SESSION["cname"];
$dbhost='localhost';
$dbuser='shitanshu';
$dbpass='123';
$dbname='placment';
$conn=mysql_connect($dbhost,$dbuser,$dbpass);

if(! $conn)
{
    die('could not connect'.mysql_error());
}
mysql_select_db($dbname);
$sql= "SELECT companyname,jobid,profile FROM compnayjob";
$result=mysql_query($sql,$conn);
$count=mysql_num_rows($result);

?><table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<td><form name="form1" method="post" action="delete1.php">
<table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF">&nbsp;</td>
<td colspan="4" bgcolor="#FFFFFF"><strong>Delete multiple rows in mysql</strong> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">#</td>
<td align="center" bgcolor="#FFFFFF"><strong>Company Name</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Job Id</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Profile</strong></td>

</tr>

<?php
while($rows=mysql_fetch_array($result)){

?>

<tr>
<td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['companyname']; ?>"></td>
<td bgcolor="#FFFFFF"><?php echo $rows['companyname']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['jobid']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['profile']; ?></td>

</tr>

<?php
}
?>

<tr>
<td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td>
</tr>

<?php

// Check if delete button active, start this 
if($delete){
for($i=0;$i<$count;$i++){
$del_id = $checkbox[$i];
$sql = "DELETE FROM compnayjob WHERE companyname='$del_id'";
$result = mysql_query($sql);
}
// if successful redirect to delete_multiple.php 
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=delete_multiple.php\">";
}
}
mysql_close();
?>

</table>
</form>
</td>
</tr>
</table>

Edited by shitanshu_1

2
Contributors
1
Reply
7
Views
2 Years
Discussion Span
Last Post by DaveAmour
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.