Forum Moderators: coopster
Hi, thanks for answering in advance.
How do I mass delete all entries that has a value, say 123.123.com under the column "remotehost" in a table? Any SQL query that fits my description?
You see, this is a counter script and I am trying to remove all the counts that belong to me.
Thanks. :]
function db_connect()
{
$result = @mysql_pconnect("aaaaa", "bbbbb", "cccccc");
if (!$result)
return false;
if (!@mysql_select_db("dddddddd"))
return false;
return $result;
}
?>
<?php
$conn = db_connect();
?>
<?php
$query="delete FROM articles where adate between '$date_start' and '$date_end' and sectionID='$section_id'";
$result= mysql_query ($query);
?>
then do a simple form to pass value
1. What are aaa bbb ccc ddd supposed to represent?
2. "then do a simple form to pass value" What do you mean by pass value? Do you mean like "echo $result"?
Thanks for replying!
P.s. I do not know what are $result and $conn for, but I will read the help files to understand.
host name such as localhost or whatever your db host has provided you with.
your username
your password
DDDD stands for the table name
here is the form I use along the above script which is named
del.php
look at the variable $..something of the form
they store the data you want to pass to your php script.
hope it helps
as is you may change the form fields, change in accordance the del.php script
add your own DB server data (A, B, C, D)
and you'll be in business
you may see that I use a beginning date and an ending date
plus a section id
of course feel free to change it all to your like
just be aware that I did not include any warning or security
against oneself
weight your typing options, when you will clik on the form
your decision is final
there is no way back
so first add a few data that you don't care about
and see how the delete reacts
also i ALWAYS DO A FRESH DB BACKUP
BEFORE ANY DELETTE SESSION
CHEERS
Henry
<html>
<head>
<title>Del from Articles</title>
</head>
<body bgcolor="ffffcc">
<table width="650" border="5" align="middle" valign="top">
<tr>
<td width="640" align="left" valign="top">
<h4> Admin only- Delete from Articles<br>
ORDER: Year, Month and Day</h4>
<p>
<form action ="del.php" method="post">
Enter date_start:<input type="text"name="date_start" value="<?php echo $date_start;?>">
<p>
Enter date_end:<input type="text"name="date_end" value="<?php echo $date_end;?>">
<p> <!-- // following are the section ID -->
<b>4=Round-up; 5=Roundup Archives<br>
6=Business; 7= Business Archives<br>
8=Business People; 9= Business People Archives<br>
10=Events; 11= Events Archives<p>
Enter section_id:<input type="text"name="section_id" value="<?php echo $section_id;?>">
<p>
<br>
<input type="submit"></form>
</tr></td>
</table>
</body>
</html>