NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Having trouble with delete

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 07-05-2006, 04:49 PM THREAD STARTER               #1 (permalink)
NamePros Regular
Join Date: Dec 2005
Posts: 210
wackyjoe is on a distinguished road
 



Having trouble with delete


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 Code:
<?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">&nbsp;</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($resultMYSQL_ASSOC)){
????: NamePros.com http://www.namepros.com/programming/213828-having-trouble-with-delete.html
$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') ";
????: NamePros.com http://www.namepros.com/showthread.php?t=213828
$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>
wackyjoe is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 02:29 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger