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 Record From Mysql


I am just tring to delete on record based on a link generated. The link shows up, the number of the field is shown as deleted when the link is clicked, but the entry ios still in the db. Maybe a problem with how I have the db setup? I only have one field, add_manufacturers, and it is text. It is in a table called manufacturers. Code:




View Complete Forum Thread with Replies

Related Forum Messages:
Deleting A MYSQL Record From Within An Html Form
Just rebuilt an admin tool in PHP (originally built in asp) for a news section of a site.
The problem is: My delete records php page is set out in an html form, with each news story expressed with a checkbox. normally i'd put a <a href="delete.php?id=<? echo $row->id; ?> </a> alongside the record, but i need to have it work in a form.

What action should the form have, and how do i get the form to process the deletion process with the correct news story checkbox selected?

View Replies !
Deleting A Mysql Record In Active Result
I'm doing a select in wich I retrieve some values. If the value is in an array, I must delete the record. As I'm doing a "mysql_fetch_object", may I delete this record inside the loop ?

when doing a mysql_query, do I have a "local" copy or just a link to the mysql query result. In the first case I may delete the record as I get an "image" of the query result, in the second case I shouldn't as the query result will be changed by the deletion of any record.

View Replies !
Deleting A Record.
One last (hopefullly) problem I can't seem to get around for this
program...why isn't this deleting the row i want? It does nothing. Now error
messages either. HELP!

$link = mysql_connect("localhost");
if(! $link)
die("Could not connect to MySQL");

$database = "PC_Store";
mysql_select_db($database)
or die ("could not open $database: ".mysql_error() );

$result = mysql_query("DELETE FROM inventorydata VALUES('$ProductID')");

The $ProductID variable is brought in from a menu choice on a diffrent page,
it is also the primary of the table...so it should delete the whole row
right?

View Replies !
Safely Deleting A Db Record With Php
I hope I'm not OT.

I have the following issue:
I want to delete a record from my db with a php script. Let's say I'm auth'd
and I want to delete the record id 440. With a simple form (get or post), I
send the id to my script and delete the record (DELETE FROM table WHERE
id=some_validated_input).

The problem is if I'm a nasty guy I just write my own form and delete any
record I want (since I'm auth'd) by just sending another id.

Is there any way to make arbitrary record deletion non-trivial in php? I'm
thinking about a hash function to replace the real db id (DELETE FROM table
WHERE record_hash=validated_form_hash), if possible without adding an
awfull lot of server side computation.

View Replies !
Deleting A Record From Another Table
I would like my code to delete the relevant confirm_code from the temp_users table but I'm getting the error

Your account has been activatedYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE confirm_code = '5f6feb0f5d104c2a6b7ce24d40711f74'' at line 1

My code:

View Replies !
On Click Deleting Record From Table
i want to run delete statement on click , how to do this Basically i want to run this on click of button mysql_query("delete from messages where message_id='$id'");

View Replies !
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 !
Updating Auto Increment Field After Deleting A Record
So much for thinking MySql is smart, but what's an easy way to update an auto increment field after deleting a record. the code is below, please help, specifically part 3 is where the magic happens. thanks in advance. by the way id is the name of the auto increment field. Code:

View Replies !
How To Securely Store A Record Index When Editing A Mysql Record
is there a secure way
to do this? the non-secure ways are, as i understand it, to populate
a listbox with indices as names, or maybe use a hidden control. is the
only secure way with sessions? i was also thinking about perhaps
creating a meta table that says who is editing which record right
now. any advice?

View Replies !
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 !
Deleting From Mysql Table
i'm trying to replace a record in a mysql table but i'm having problems. First i've got a page to store existing film name values using:

<input type="hidden" name="Name" value= "<?printf($row["Name"])?>">

The second page is supposed to delete the existing record by comparing the stored name value with the database name but it only creates a a duplicate record. Here is the code for this: Code:

View Replies !
Deleting One Row From Mysql Table
I want to delete one row of a mysql table, and still to be in the same page, but the page needs to be reloaded and to give me new results Code:

View Replies !
Deleting Mysql Rows
Is there an easy or another way to delete rows? Right now I'm checkmarking the row I want to delete and then clicking on the red x for each one. It takes absolutely forever. Is there a better way?

View Replies !
Deleting Rows In Mysql
I'm struggling to find the right way to formulate a mysql query. I want to do something like Delete from thedatabase where field2 and field 3 on somerow have the same values as field2 and field 3 on someotherrow.

I can't figure out how to compare the data from two different rows. Anyone have any ideas on how I can do this?

View Replies !
Deleting Rows From MySQL
This SQL query (table names changed) find a set of records I need to delete from a MySQL 4.0 table (so subqueries are probably out).

SELECT tablename.id
FROM tablename JOIN cards
ON tablename.card_id = relatedtablename.id
WHERE tablename.user_id =1
AND relatedtablename.set_id =1

Any hints on how to delete these rows? (Short of upgrading to a newer MySQL, since it's not my server.) I'd prefer to do this with a SQL statement, instead of "punting" and writing a PHP page.

View Replies !
Deleting Data From MySQL
At present when we develop CMS driven websites, when content is deleted it is marked as deleted within our MySQL database so it is never actually deleted incase, for example, it was done by accident. We do this by having a table field simply called "deleted" set to either 0 or 1. What I am asking is does anyone else do this or something similar? And if you do, what method do you undertake yourself or recommend.

View Replies !
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 !
Mysql And Php5 Deleting Rows
I can't seem to delete rows from a mysql database. I have a database
that I want to delete rows from based on user name. i have researched
this extensively and can't seem to find anything that works.

View Replies !
MySQL Delete Only Deleting Content
I am working on a content editor for a client who wants tha ability to add new page. But he also has to be able to delete page. The pages are refered by their PID column which is set to auto increment.

However, when I delete a row, for some reason, it deletes the content in the row, but not the row itself. So, I have an empy row left which gets assigned a PID when I drop the PID column and reconstruct it with the new auto_increment numbers. What could be causing this? Or is there a way to renumber the auto_increments after a page has been deleted? My coding is a little rusty right now as I am out of practice. had to have a reference manual by my site at all times. PHP Code:

$sql     = "DELETE FROM $db_table WHERE PID = $id LIMIT 1";
$result = @mysql_query($sql, $db_connect) or die(mysql_error());

$drop     = "ALTER TABLE $db_table DROP COLUMN PID";
$result = @mysql_query($drop, $db_connect) or die(mysql_error());

$add    = "ALTER TABLE $db_table ADD PID INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST";
$result = @mysql_query($add, $db_connect) or die(mysql_error());

View Replies !
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 !
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 !
Problems Deleting Rows In MySQL
im trying to make a delete page so, my mom , can delete all her photos or old new of her website as easy as a click, the problem it aint working ! Code:

View Replies !
& MySQL - Updating & Deleting Records
I am very new to MySQL and have built myself a small database for website update requests. The thing is Instead of having a "enter the record id # and press edit" I want to have a small edit icon at the end of each record I am displaying in a table. I've got the table data box setup at the end of the record and this is what I put in it: Code:

View Replies !
Batch File Deleting And Folder Deleting
I have a folder in my web site where I used php to create and copy in files. but now I can't delete them easily. The only way I know how that is possible is through php. I get an error the following ftp error:

550 th: Permission denied
I had the chmod() set to 0777 on every file and folder. But I still seem to loss control over the files when I try and do things with them through other means.

I think it is because the user I use to access the files via ftp a diffrent user. So I tryed to add a function with chown() for the new files I was posting and uploading. It didn't work on those new files. so it looks like the only thing I can do is use the unlink() function which deletes the files fine.

The only problem is now I have something like 100 sub directories all with files in them. I need to figure out a way to batch delete them. I can't find a script that goes through and finds all file contents including all sub directories and unlink those things.

I found some that will use a for loop to list out the contents of a folder but it is just files. No sub directories. Any body got any ideas on which functions I should use or know where a script is that I can base mine off of.

I am not sure how to approach this since what I tryed with chown and chmod has failed thus far. I currently have no code and am starting from scratch on this batch flushing of my directory.

View Replies !
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 !
Getting One Record From MySQL
I am very new to php-mysql, and im a bit confused by all the tutorials which explain how to get records from mysql. In all the tutorials, they show how to recover all records from a table using a loop command.

I have a mySQL table called news, which has headline and a body fields (as well as id). On my php page, i have two seperate tables. One I wish to print the info from one of the headline fields , and the info from the field body in the other.

I don't wish to print all the records.

View Replies !
Add Record To Mysql Via Php
I am using Yahoo hosting. When I run my script, I get error on line 16, which is

@ $db = mysql_pconnect(,'nitmal','xcxcxcxcx');

Should there be a parameter I need to pass before user name.

View Replies !
MySQL Next Record
Is there any easy way to see if there is a next or previous record in a MySQL table without looping through all the records? If I select a row, can I ask if there is a row before and/or after that row.

View Replies !
Best Way To Update A Mysql Record
I have a small app that a user can select an entry to be considered as "cancelled". This will change an entry in a mysql database.

Is there someway of making a button that as soon as its clicked, sends the appropriate update info to the database and reloads the page?

View Replies !
Please Help With A Record Problem With MySql
I have php code that enters information into a mysql database. How can I make it so that the person entering the information has the choice for the listing to expire after a given number of days. Therefore I would like the record to become not active after this period.

View Replies !
Accesing A Record In MySQL And PHP
I am accesing a record in a MySQL DB with the a sentence embeded in a
php code. The result access a page like:

http://www.mysite.com/page.php?id=16

where the id=16 indicates the id of the result. This work perfect, but
I don´t want the user to know that the number 16 correspond to a
specified record. I´d like to change the 16 for an algoritm. The
algoritm result will be 16, but this will be only know by the database.

As example, I´d like that

http://www.mysite.com/page.php?id=ewrefj34239dsa

equals

http://www.mysite.com/page.php?id=16

View Replies !
UPDATE A Record In MYSQL DB With PHP
What is the best way to update a record in a MYSQL DB using a FORM and PHP
?
Where ID = $ID !

Any examples or URLS ?

View Replies !
Getting The Last INSERTed Record From Mysql
I remember reading about a function that will get the last inserted mysql record, but I don't recall if this is a php or mysql function. What is the name of the function?

View Replies !
Record Expire PHP / MySQL
I created a database that lets people post a job opening. I thought of
manually removing each entry after 2 months, but is there some code that
can do this without me having to monitor the table?

View Replies !
Adding Record To A MYSQL DB Using PHP ?
What is the best way to add a new record to a MYSQL DB using a FORM and PHP
?
Any examples or URLS ?

View Replies !
Edit Mysql Record
I want to use a userform on a webpage so members can edit their data.

Displaying the data on the form isn't the problem.
But when members change their data how do i save then new data in their
record. I dont want a new record.

View Replies !
Mysql Delete Record
when I run this code below it doesn't delete the record or display any error message

$id = $_GET['id'];
include("../dbconnect.php");
mysql_query("DELETE FROM promotions WHERE id='$id'") or die(mysql_error());

Such a simple thing to do but I don't no why it doesn't work 

View Replies !
Not Updating Record Into MySQL
I am attemting to update a MySQL record and after I hit the submit button from the update form  I get a blank white page. I have error reporting on, but still nothing. Code:

View Replies !
Finding A Mysql Record
So when a client came to me and asked if I could create a website that would allow users to search the traceability details of his products, I rose to the challenge and said yes.

Let me exlpain further: The client produces a fish product, and has a simple (one table) database, with about 5 or 6 fields, that give details about the harvesting dates, the geographic origin, the batch number, etc. for each batch of fish.

I managed to create the table in a mySql database using phpMyAdmin. I also managed to create a set of "out-of-the-box" user admin tools for the client, by installing a free script (phpMyEdit I think). Code:

View Replies !
Add A Record Into My Mysql Database
I have the following code to add a record into my mysql database: Code:

View Replies !
Inserting Record Into Mysql
If someone goes to mypage1.php and their ip address is already in my mysql database, how can I find that record and update the "status" field so it says "Yes"?

View Replies !
Mysql Record On Page
I'm trying to link to a specific record from one page to another. Let me try to explane:
I have a homepage with some of the records of the latest news table + a link to "read more". I have the news page with all of the records of the latest news table Now when I click the read more link on the homepage I want to go to that specific record on the news page. I've tried to use

printf ("<a href='http://www.crivic.com/latest_news/index.php?id=$rij[id]'>(read more...)</a>");

View Replies !
How To Duplicate Record In Mysql
Is there a simple select or subselect statemet that will duplicate a record from within a table.

I tried some thing like this insert into howto select * from howto where howto_id=31;

I think I am running into a problem because the howto_id is my primary key. Is there someway of doing this, simple.

I could do it with PHP by calling that record and storing the variables and then inserting without the howto_id, but that seems expensive. Seems like there should be a simple sql statement to accomplish copying a record within your table.

View Replies !
Updating A Record In A MySQL DB
Maybe this is where i am going wrong, but I am using dreamweaver for this form. Right, made a form to insert a record into a mysql db. this works fine, no problem here.

I then copied this form, and then modified it to an update form. The main difference is that that form text boxes are pre-populated from the database, thus allowing easy modifications. however, the box where I browse for the image is empty Code:

View Replies !
Updating A Record In A Mysql Database
I am sorry if this is a simple oversight, but I have been struggling for many hours over something which seems dead simple.

I need to update a record in a table with more info. I am using the code below which soen't give me any errors but nothing happens.

include("link.inc");
$db=connect_db();
$db_name=db_name();
mysql_select_db($db_name,$db);

$sql="UPDATE data SET age='age',live='live',whatdo='whatdo',drinkalcohol='drinkalcohol',takedrugs='takedrugs',firstdrug='f irstdrug',seconddrug='seconddrug',medicine='medicine',alcohol='alcohol' WHERE id='$id'";
$result=mysql_query($sql,$db);

View Replies !
PHP-MySQL: Returning ID When New Record Is Made?
Let's say I create a new record in a table like this:
mysql_query("INSERT INTO table (col1) VALUES ('example')",$conn);

....that had an auto-incrementing, unique identifying column named "ID"
that would be populated with a unique number upon insertion...

How can I get the unique number it assigned to that record returned for
futher use?

View Replies !
Output Xml File From Mysql Record
how to get the record from databse directly..but now my application require me to output my record as xml output....so I really need help on it.../some guide ...this is what's my xml gonna be.. Code:

View Replies !
Check Duplicate Record In Mysql
I am trying to make sure that I do not insert a duplicate record in the database.  Here is my code:

View Replies !
Applying A Class To The First And Last MySQL Record
I need to apply a class to the first and last records from a MySQL query. What I'm trying to do is pull the menus for my site but the first and last links need a class name for the design. I can't set them in the database because the order and items in the menu will change from time to time.

so, here is how I pull my menu (cut down for this post). You can see it just grabs the name, url and makes a link. How would I apply a class to the first and last records?

mysql_connect("localhost","root","password");
mysql_select_db("my_site");
$result = mysql_query("SELECT * FROM menu ORDER BY id");

while ($are=mysql_fetch_array($result))
{
$name = $are['name'];
$url = $are['url'];

print '<a href="'.$url.'">'.$name.'</a>'."
";
}

View Replies !
Select SECOND Top Record In Table + Mysql
how to get second hightest record in table is there posible in mysql

View Replies !
Inserting Unique Record MySQL
Are you able to check if a record that you are about to insert into one table isnt already located in another table? Obviously I can do a select query and check that way, however I am inserting multiple values in one statement and this is not efficient. The column is called "URL" in both tables and they are both set to unique. Can I somehow check if the value I am inserting is unique to both tables?

View Replies !
Checking For Existing Record In MYSQL
I've got a mysql database with a single table. I also have a page containing a FORM with a number of fields that once submitted is stored into the database.

My problem is, users are able store the same information more than once. How do i check if that record already exists before inserting into mysql table?

For example, I want to check that, that particular username, nickname and email exists in the table. If it does, print out a warning. If it doesnt exist, go ahead and perform the query and insert the record.

View Replies !

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