Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Deleting Entries In A Database


I've got the reading and writing to a database working but want to delete entries ..... how would this be done?




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Deleting Old Database Entries
I'm trying to make a code that searches a database to check for entries that are 3 months old and then erase them.

My problem is that I got no idea on how to make a variable that checks the current date so that I might compare it with the entry date, and also how should I make my If or While loop so that it works, I mean it's obvious that it must compare the two dates but how do this.

View Replies !   View Related
Deleting Duplicate Entries From MySQL Database Table
The topic is related to MySQL database.

Suppose a table "address" contains the following records

-------------------------------------------------------
| name | address | phone |
-------------------------------------------------------
| mr x | 8th lane | 124364 |
| mr x | 6th lane | 435783 |
| mrs x | 6th lane | 435783 |
| mr x | 8th lane | 124364 |
-------------------------------------------------------

Quote:

View Replies !   View Related
Deleting Entries
I have a some-what working blog for my web development class, meaning I can add and edit entries. Deleting entries, however, seems to be something way above my abilities. I figured deleting would be as easy as editing, and since they're similar, I'll describe my edit process.

First I have a main view page. When one clicks "edit," it goes to edit.php?id=$id Next, edit.php uses $GET['id'] and then prints the subject in the subject field, the date in the date field, the blog in the blog field. When you hit submit, it sends it to the update.php Upate.php updates the database. My logic as follows for the delete page:

From the main view page, one clicks "delete" and goes to the delete.php?id=$id
Delete.php removes the entry.
Delete.php gets a list of all the IDs.
Delete.php sets the first ID to 1, the second to 2, etc..

Would I need four files for this? I'm attempting to put three queries on one page and I keep on getting unexpected variable ($query) errors.

View Replies !   View Related
Deleting Entries From Mysql
I have business listings that I have pulled from a database(MySQL) and printed to the page, in an admin page, for review. I'm trying to write a script to add and one to delete the listing.

I get an SQL error, 'check the manual for blah blah near " on line 1'

Here is the 'delete script:

View Replies !   View Related
Deleting Entries In The Address Bar
I am sick and tired of looking at all that clutter that automatically pops up on my address bar, how do i get rid of all those enteries?

View Replies !   View Related
Deleting Blank Entries From Array?
The resulting arrays that i get from my select statements always seem to have some blank entries, in addition to the correct ones. It is rather odd, is there any way i can scan through it and delete these blank entries? Here is the print_r of the arrays. PHP Code:

View Replies !   View Related
Deleting Older Entries.. (mysql)
I've a comment form.. I've allowed only 10 comments to be viewd, so when I submit new comments, I want to know how to delete older ID comments except the latest 10 comments. Means if there are 13 comments.. 13...3 shd be there and very 1st and 2nd(older) comments must be deleted.

View Replies !   View Related
Deleting A Row From A Database
I can't fiqure out why my delete function isn't working. I have a listing of rows in my database with an option to delete an individual row at the end: Code:

View Replies !   View Related
Deleting From Sql Database
I have used this script I made to delete files from a server and simultaneously remove information about the file from a database. I have uploaded the same script to a new website and it no longer works. The file does get deleted but the database line doesn't get removed. I can tell where it's going wrong by the error custom error message 'echo'ed on the page ("your file was only partially uploaded"), but I really don't know why.

View Replies !   View Related
Deleting From Database
I have a PHP web form that pulls records from a database table. Based on the data in the table, the records are displayed with checkboxes that have a value that is equal to the record's ID. To handle this form submission, how do i detect which checkboxes have been checked? If this was a static form, I could handle it based on the name of the field but since the checkbox values are not static.

View Replies !   View Related
Extracting Database Entries
I have a non-profit's web site that wishes to allow their members to
fill out information regarding summer camp information (name, contact
info, mailing info, physician's name, etc) online and submit it. I can
handle taking the info with PHP and putting it into a mySQL database easily.

But what has me stuck is that they want the ability to print out hard
copies of selected submissions (their choice) if they need to.

Would I have to display all the database entries in a form on a new page
with a select box next to each entry and have them pick that way, then
loop through and print out the selected ones or is there a better, more
direct (read: easier) way to accomplish this?

Does this sound like something for which there may be a pre-written PHP
script that can be altered?

View Replies !   View Related
Array From Database Entries
All I need is to create an array with the results from a database column.

View Replies !   View Related
(PDO) Database Entries Are Not Possible, Even Without Errorfeedback!
I am trying to insert with PDO-Sqlite rows through a form. I can do
whatever I want, I don't find the sollution where I made the error.
Perhaps somebody of you could help me?!

However, the database is created with sqlite, and the entries should be
done with PDO_SQLITE. However, no entries are done anyways and I am one
step going nuts, specially because I don't receive no warning or
errormessage on the screen.

Code:

<?php
require_once('HTML/Form.php');
require_once('I18N/UnicodeString.php');
require_once('HTML/Table.php');

class Formular
{
private $ServerVar = array("Auswahl","Betreff","Eingabe");

function __construct()
{

$this->ServerVar["Auswahl"] = $_GET['Auswahl'];
$this->ServerVar["Betreff"] = $_GET['Feld'];
$this->ServerVar["Eingabe"] = $_GET['Eingabe'];
$this->MeinFormular();

//$this->sqdb();
if(($this->ServerVar["Betreff"] === null) or
($this->ServerVar["Eingabe"] === null))
{
$this->MeineDB();
$this->TextFeld();
}
elseif (($this->ServerVar["Betreff"] === "") or
($this->ServerVar["Eingabe"] === ""))
{
$this->MeineDB();
$this->TextFeld();
}

else
{
$Auswahl = $this->ServerVar["Auswahl"];
$Betreff = $this->ServerVar["Betreff"];
$Eingabe = $this->ServerVar["Eingabe"];
$this->MeineDB2($Auswahl,$Betreff,$Eingabe);
$this->TextFeld();
}

View Replies !   View Related
Edit The Entries In The Database
I have a script that allows you to edit the entries in the database. All is working fine except when you pull up an entry for editing the subject field only prints out the first word of the subject??? I know the entire subject line is in the database, but only this part of the script won't print it out. All the other fields work fine. Code:

View Replies !   View Related
Limit Entries In Database?
Im using a guest book script that uses a Mysql database. Id like to limit the number of entries it will save in that database to say, 100. I emailed the fella who wrote the script and he replied with:

Just make a simple if the id is bigger than 100 or how many entries you want ... then just redirect to the index page. I dont know a whole lot about PHP although Im learning and this is what Im trying which isnt working.

if ($id > 100){
echo "<meta http-equiv=refresh content=1; url=http://www.mysite.com/blah>";
}

View Replies !   View Related
List Last Entries On Database
I'm looking for a script that will list the last 20 entries from a mysql database, can anyone on the list help me ?


View Replies !   View Related
Comparing Database Entries
I have two table in a database, one with products one with reviews. The reviews are linked to the product via a unique id but I'm looking to write a script which can see if a product in the database has been reviewed or not but I hit a "coders block" . I was going to use a loop to see if the id in the review table matched any in the products table but I would prefer the script to only show the ones which haven't been reviewed and so that would not be the best way since it would chuck out a 'False' every time it didn't match up.

View Replies !   View Related
Show Last 5 Database Entries
I just set up a database with tutorials (id, title, description, image, url, cat)
id is auto_increment, so the highest id should always be the last tutorial. I want to show the last 5 tutorials on a page, so I tried to use this: PHP Code:

<?php
include("connect.php");
$sql=mysql_query("SELECT * FROM tutorials ORDER BY id DESC LIMIT 0,5") or die(mysql_error());
$x=0;
while($row=mysql_fetch_row($sql))
{
echo ($x+1).')&nbsp;'.$row[title].'<br />'
$x++;
}
?>

But I got this output:
1)
2)
3)
4)
5)

View Replies !   View Related
Counting Entries In Database
I have a database with various fields... one of them is "region"

REGION
r1 = Scotland
r2 = North East
r3 = North West
etc etc

then on my html/php page i want to list the regions, then in brackets add how many entries there are in the database for that region.

Scotland (?)
North East (?)
etc etc

The question is how do I count how many entries for each region and then show the result.

View Replies !   View Related
PHPMyAdmin ... Deleting A Database?
I just want to delete a test database that I made, thats it. There is no upfront obvious way of doing this from my pov so thats why I'm asking.

View Replies !   View Related
Deleting Records From Database
I have another question about record deletion from
database.

For example, my database has 10 records with ids 1
through 10. If I delete id #10 then everything is good
and all the records are still 1 through 9. However, if
I delete record id #4, then in my db I would have
records 1 through 10 with id #4 missing.

Is there a command that syncs the database? How do I
go about this to keep all the ids in the right order
after the deletion? or What do I need to do to prevent
that from happenning?

View Replies !   View Related
Deleting Comments From Database
i have a message board that enters information to the data base fine, but where i try to create a detele for individual comments, it does not seem to work, any ideas on how to write a delete for this so that it deletes individual messages Code:

View Replies !   View Related
Deleting Images Associated In Database
I've got a database structure with rows containing filenames of photos on the server each with its own uploader/user and unique id number.

Can someone help me on how to delete an array of photos from the server uploaded by a specified uploader/user?

View Replies !   View Related
Problem With Deleting From A Database
I got a little problem with deleting from my database, i'm making a simple newsscript. I get a Parse error: syntax error, unexpected T_ELSE on line 24, I have written the error as a comment further down in the source delete_news.php on line 24. Code:

View Replies !   View Related
Deleting From Database If Idle
I have a league database and if a user leaves the league then the date that he left is entered into the database using.

$today=time();

the pseudo code for what I wish to do is this.

if DATE LEFT = 3 MONTHS AGO
{
DELETE USER FROM DATABASE
}

what is the code for "DATE LEFT = 3 MONTHS AGO "? OR rathar than use the IF statement could i simply add it to the DELETE query? ie. DELETE USER FROM DB WHERE DATELEFT = 3 MONTHS AGO?

View Replies !   View Related
Deleting Database Rows
I have a form with a list of checkboxes, which are each filled with a date in the format 27012007, for example. The name of each of the checkboxes is the same as the date. Basically when the user presses the submit button I would like all rows in the database table "users" with the corresponding column "date" to be deleted when the form variables date correspond to those in the "date" rows. I think all the checked dates might also need to be put into an array.

View Replies !   View Related
Deleting Rows From DataBase
I have written a script that deletes specified rows from my sql database. I use an html front page where i enter the name of the individual i would like to remove from the database.

This works fine. However i would like it to confirm with me wheather or not the action should take place using a dialog box.How best can i do that? Any scrips in mind?

View Replies !   View Related
Preventing Multiple Database Entries.
I am trying to make my form processor detect if an item name submitted to the database already exists I would like to display a message saying the item is already in the db.

I tried something like this

if ($Item_Name == "$row["Item_Name"]") {

print "That item is already in the database";

}

Now I know this is wrong but if someone could point me in the right direction it....

View Replies !   View Related
Don't Display Duplicate Database Entries?
I have a restaurants database that has a lot of restaurants listed with the same name in the same city with only the category changed. This is the code that I have that displays the list of restaurants. Can someone tell me what to add to it so that it will only display one of each restaurant of a certain name? PHP Code:

View Replies !   View Related
Fastest Way To Print All Database Entries?
Say I have a database with 1000 entries. What's the fastest, dirtiest way to do that.. Like this? PHP Code:

View Replies !   View Related
Output Database Entries In A Table
I'm trying to display the entries in a table of two columns, one entry per table cell - in other words, two entries per row, number of rows based on number of entries in the database. But it still doesn't seem to work. It displays one entry per row... I don't know where the problem is. Here's my code:

View Replies !   View Related
Get Some Data From A Database And Then Add All Of The Entries In Each Column
Im trying to get some data from a database and then add all of the entries in each columb to get the total for each columb.  I tried it with the following code but got the error: Warning: Invalid argument supplied for foreach() Code:

View Replies !   View Related
How Do I Display All Database Entries Between Two Dates
I have two dates in a form " startdate" and enddate"

when i display the results i would like to show all results between, and including the two dates. how do i do this... this is my current query:

My Variables:

$userid = $_GET['idr'];
$fromdate = $_GET['fromdate'];
$todate = $_GET['todate'];

The query:

$result = mysql_query("SELECT date, status, time, notes FROM timeclock WHERE userid='".$userid."' ORDER  BY time");

View Replies !   View Related
How To Delete Multiple Entries From Database?
I ran this script Im working on twice by accident which caused a ton of duplicate entries. I dont want to start over so how would I delete multiple entries in a database?

View Replies !   View Related
Select Entries From A Database Where The First 3 Characters
I want to select entries from a database where the first 3 characters of one of the fields (title) are equal to 'BMX'. Is there a way of doing something similar to this as a query?: PHP Code:

substr($row['title'],0,3);

View Replies !   View Related
Getting Form Entries To Mysql Database
Here's the scoop after 2 days of screaming profanities at my monitor I need Help... I built a web form looks good but worthless...I also set up a msql database with a table and all the rows I need using mysql admin also worthless unless I get the entries from the form to save to the database. I have tried a hundred different scripts and variations thereof. Warning I am a real estate agent not a computer whiz so the php and mysql documentation is like reading a dead language the jargon is useless to me....

View Replies !   View Related
Splitting Articles / Database Entries
Sometimes when I read websites they split their articles over multiple pages. Now that I'm doing my own site I'd like to do this with my lengthier articles. What I want to know is how people would approach this with respect to the PHP/mySQL side of presenting the information? How would you decide how many pages to split the article into and how would you actually split it so that the user can click page 1, 2, 3, or n ?

View Replies !   View Related
INSERT Adding Too Many Entries To Database
I have the following code to add an entry to my visitors table to track referers and what pages they visited, etc.

$sql_ref_update = "INSERT INTO visitors (refdate, referer, refpage, refip) VALUES ('$refdate', '$referer', '$refpage', '$refip')";

if(!mysql_query($sql_ref_update)) die(mysql_error());

I just found that when I do this, where I expect one entry to the databasae, I'm getting three (two of which have are the same IP). I'm assuming that the second IP I'm getting might be a firewall or caching server but why two entries for the one IP on one visit?

UPDATE: I found that one of the IP "visitors" is caused by the Google toolbar being on. I didn't know that the toolbar counted as a referer. Why is this? Is this well known because I didn't know about this until now.

View Replies !   View Related
Averaging Entries In A MySQL Database
I have an array of numbers in one column of my mySQL database. I've extracted them into an array. How do I find and display the average and total of all of them?

View Replies !   View Related
Getting Data From Database - Entries Not In Right Format
I am running an online job search site and employer are able to post their job vacancies under multiple categories.

Example - Accounting,Administrative,Hospitality
The example above is taken from the category table in the database.

The problem is, I am trying to create a script that lists al the jobs available in each category and its not listing the jobs that employers have selected multiple categories, its only listing the jobs that have been added into only one category. Code:

View Replies !   View Related
Save The Checked Entries To Database.
I have checkboxes in my script and i need to save the checked entries to my database.
i made the checkboxes an array. the problem is, when i try to print the array, what prints is the name of the array itself and not the content of the array. here's the code:

$check_entries=array();
$check_entries=$_POST["check_entries"];

$check_count = count($check_entries);
print($check_count);

for($a=0; $a<$check_count; $a++)
{
print($check_entries[$a]);
}

output:
check_entriescheck_entries.

View Replies !   View Related
Skipping Database Entries Using A Loop
I am using this code to read from a paper database and display the result in a dropdown menu in out website. What I am trying to do is skip the entries that have the resolution field less than 2880 (elseif($paper_types_4800[$x+5]) < 2880 in the code below).

I've gotten it to just echo blank spaces in the dropdown menu but they can still be selected and submitted. How to I skip these entries entirely in the dropdown menu? Code:

View Replies !   View Related
Update Multiple Database Entries
I want to make a quick to-do list script. I can handle entering the info, etc.

What I have a question about is when I go and view the list of to-do items, once they are complete, I want to be able to mark them "Done"

So I'd have a list of all the items and a checkbox for each item. If 3 of 10 are done, I'd select the checkbox for those three, click the submit button and I'd like it to update one field for each entry.

So, I'd have todo_ID, todo_DONE and want to UPDATE todo_list SET todo_DONE = 1 WHERE todo_ID = '".mysql_real_escape_string($_POST['todo_ID'])."'

My question is how can I do this for multiple entries all at once?

View Replies !   View Related
Deleting A Table From A MySQL Database
I've looked at the manual and a few other php resources, but yet I couldn't find a simple and easy way to delete a table using php. I noticed there is a destroy() function within the MySQL class, but I'm not sure how it's used.

View Replies !   View Related
Problem Deleting In A Database: Mysql
I am having a problem with deleting from a database. I have my deal_manage.php page which has a delete link so as to delete a record from the DB table (called product), the link goes to my deal_remove.php page which has my query on it to remove the product.

I think the problem may be that the id# of the item is not getting through to the remove_deal.php page as when I click the delete link it goes to the remove page but the product is not deleted and i get my 'product was not deleted' message. Code:

View Replies !   View Related
Using Checkboxes To Update Multiple Database Entries
I have a query that shows a list of options that a user can toggle on
or off using a checkbox.

query...
form...
while($row = mysql_fetch_array($result))...
<input name="menu_show_attribute[]" type="checkbox"
class="checkbox"');
if ($row['menu_show_attribute'] == 1) {
echo (' value="'.$row[menu_id].'" checked />
} else {
echo (' value="'.$row[menu_id].'" />');
}

The list is generated from boolean values in a DB. This populates my
form with checkboxes, some are checked and others are not. I'm using
an if statement to sort it (checked). This works fine.

The problem is when the user un-checks a checkbox, the value does not
get passed and the DB does not update - set/change it to 0. The only
values that get passed are the checkboxes that are checked. Below is
the query / code after the submit button has been pressed. Are radio
buttons the answer? Any help / suggestions would be very much
appreciated.

//process form
for ($i = 0; $i < count($menu_show_attribute); $i++) {

if (isset($menu_id) == 'checked') {
$menu_show_attribute = 1;
} elseif ($menu_show_attribute != 'checked') {
$menu_show_attribute = 0;
}

$query = 'UPDATE menu SET menu_show_attribute = "'.
$menu_show_attribute.'" WHERE menu_id = "'.
$menu_show_attribute[$i].'"'
echo("<br>");
echo $query;
$result = mysql_query($query, $db) or die(mysql_error());
}

View Replies !   View Related
Archiving Versions Of Database Entries And Diff
I'm looking to change a database application so that when users make changes, a certain number of versions get archived so that users could potentially see previous versions and, preferably, get some diff output.

The goal is really to version one large text field, though I would probably archive the entire record from that table. Code:

View Replies !   View Related
Form Generating Blank Entries In Database
I have a form which will be used to add entries to an SQL database. However, when you load the page it generates a blank entry in the database (not just refresh but on initial page load too).

What's the best way to stop the submission happening on every page load so that only by clicking the button will an entry be created?

View Replies !   View Related
Text Formatting - Print Out Entries In A Database
im trying to print out entries in a database. it prints out okay but im having trouble formatting the text- changing colour, font etc. The following code works ok if i just use a variable, but it doesnt work here

echo "<td><font face="Verdana" color="#E5E5E5" font size="+4">{$row['productName']}</font></td> ";

View Replies !   View Related
Deleting Not Working - Flat File Database
I have to decrypt the $email variable in order to delete from a flat file database. I am not sure how to do this... It decrypts it and trims it to display on a select field, but I don't know how to make it delete. Code:

View Replies !   View Related
Checking If A Value Is Not In An Array And Deleting Record From Database
I have been trying to figure this one out and have come up against a brick wall although I know it should be relatively simple. I have a form that passes an array to a php script from a multiple select box that is created dynamically.  If a user deselects an item then I want to delete the record from the database but am having a big problem with it. The table in the dbase is quite simple with just three fields:

id
classid
formid

Basically, the form send through a classid and a formid value and I want to delete any records that have a classid that are not in the form array and have a formid which is passed as a hidden value. I suppose really what I want is to know how to see if a classid is not in the array that is passed.

View Replies !   View Related
Deleting Database Rows From An Array Of Variables
I have a form with a list of checkboxes, which are each filled with a date in the format 27012007, for example. The name of each of the checkboxes is the same as the date.

Basically when the user presses the submit button I would like all rows in the database table "users" with the corresponding column "date" to be deleted when the form variables date correspond to those in the "date" rows. I think all the checked dates might also need to be put into an array. Would anyone know how to do this?

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved