Having trouble with delete

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Watch

wackyjoe

Established Member
Impact
3
Hi there,

I made this site for a client, but i cant get the delete page to work.

All it has to do is when deleted is clicked it has 2 add the fields to another database and delete it from the oiginal.

I cant manage to get it to add itself to the other database and when i put in the delete from original it just dosent work.

Any help is appreciated.

Heres the code:


PHP:
<?php


$host="localhost"; // Host name
$username="wackyjoe"; // Mysql username
$password="******"; // Mysql password
$tbl_name="calls2"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT id,Date,Time,Name,DOB,Address,Notes,inum FROM calls2 ORDER BY id DESC";
$result = mysql_query($sql);


?>
<table width="723" border="0" cellspacing="1" cellpadding="0">
<tr>
<td width="721"><form name="form1" method="post" action="">
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="50" bgcolor="#FFFFFF"> </td>
<td colspan="7" bgcolor="#FFFFFF"><strong>Please Select a Checkbox and hit Delete.</strong></td>
</tr>
<tr bgcolor="#00CC66">
<td align="center"><strong>Delete</strong></td>
<td width="136" align="center"><strong>Date</strong></td>
<td width="79" align="center"><strong>Time</strong></td>
<td width="94" align="center"><strong>Name</strong></td>
<td width="80" align="center"><strong>DOB</strong></td>
<td width="150" align="center"><strong>Address</strong></td>
<td width="81" align="center"><strong>Notes</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result, MYSQL_ASSOC)){
$id = $rows['id'];
$date = $rows['Date'];
$time =$rows['Time'];
$name = $rows['Name'];
$dob = $rows['DOB'];
$address = $rows['Address'];
$notes = $rows['Notes'];
?>
<tr>
<td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['id'] ?>"></td>
  <td style="background-color: #FFFFFF;"><? echo $rows['Date']; ?></td>	
  <td style="background-color: #FFFFFF;"><? echo $rows['Time']; ?></td>
  <td style="background-color: #FFFFFF;"><? echo $rows['Name']; ?></td>
  <td style="background-color: #FFFFFF;"><? echo $rows['DOB']; ?></td>
  <td style="background-color: #FFFFFF;"><? echo $rows['Address']; ?></td>
  <td style="background-color: #FFFFFF;"><a href="notes.php?id=<? echo $rows['id']; ?>" target="_blank">View Notes</a></td>
</tr>
<tr>
<?
}
?>
<td colspan="8" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td>
</tr>
<?
if($delete){
for($i=0;$i<$count;$i++){
$del_id = $checkbox[$i];
$sql = "
INSERT INTO calls (id, deleted, Date, Time, Name, DOB, Address, Notes, 
	inum)
	VALUES
(
'', 1,  ' $date', ' $time',
 '$name', '$dob', '$address', 
 '$notes') ";
$result = mysql_query($sql);

if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=delete.php\">";
}
else
{
echo'Sorry and Error Occured';
}
}
}
mysql_close();
?>

</table>
</form>
</td>
</tr>
</table>
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back