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.





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 Complete Forum Thread with Replies

Related Forum Messages:
Delete Record - When The Delete Link Is Clicked The Next Page Is Blank And Nothing Is Deleted.
This is my "delete.php" and this "todo/delete.php?id=64" an example of a link to it generated from the index.php page. When the delete link is clicked the next page is blank and nothing is deleted. What have I done wrong?

<?
include("dbinfo.inc.php");

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$id="delete from todo where id='$id'";
mysql_query($id);

mysql_close();
?>

View Replies !
Delete Record
i have this code for my site that will connect to my database and grab all my members there id email and ip the problem is that it dont have a button where you can select a member and delete that member can anyone help me with this?i want to add a button and a check box so if i check off a member and click a delete button it will delete that member here is the code:

View Replies !
Delete Record!
I am using PHP5 , MySQL5, Apache 2 My Database was created with phpmyAdmin.Then I inserted with script and phpmyAdmin data into the Database. Now I am Unable to empty or delete or remove any fields out of the Database. Neither a script ot phpmyAdmin can delete.What has blocked the database? I have restarted my pc, Still I am unable to remove anything.

View Replies !
Delete Record And Files
I have a code that uploads images along with some info into a directory and database, this all works fine. I can delete the record but the images relevent to that record continue to exsist in my images directory. How would i set up a php code to delete a file in ../images when the record of its name is stored in a column in my database. Here is my delete record code:

View Replies !
Unable To Delete A Record Using Php
I am having a form which displays a couple of values from database and a delete button which is used to delete that particular record. Below is the code that I am using, but I am unable to delete the record. Please help me to get the record deleted. Code:

View Replies !
Confirmation When Delete A Record
I want to add a confirmation before I delete a record. For example if the user wants to delete they press "Yes" otherwise "NO" and go back.

<?php

//delete user
$sSQL = "DELETE FROM user WHERE (`userid` = ".$_GET['record_id'].")";

$result = mysql_query($sSQL) or die(mysql_error());

echo "<h1> User deleted succesfully</h1><br>";

?>

View Replies !
Delete Record - You Have An Error In Your SQL Syntax;
Im some having  trouble with deleting a record, surely it isnt that hard, dont know what im doing wrong. this is the error i am gettin:

You 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 id=1' at line 1Here is my delete code:

View Replies !
Delete Record If Older Than 5 Minutes?
Can someone help me in writing a query command, to delete a record, if the last_update field on a record is older than 5 minutes?

My table has a last_update field, which holds a value as this for example: 2007-04-08 01:33:12

I need a query that when I access a php file, if a record is older than 5 minutes, it will delete it.

View Replies !
Click Link To Delete Record
I am trying to add a function to one of my scripts.  I would like to be able to click a link and have it delete a particular row from by DB.  Links are generated by a PHP script and are based on entries on a DB.  In this DB I have a column called 'users'.  The table is generated by the following snippet: Code:

View Replies !
Using Checkboxes To Delete Record From Database
i would like to use check boxes to delete records from the database. my problem is, the records belong to different tables. how do i indicate in my code "DELETE from blah blah... " from which table to delete from..

View Replies !
Dreamweaver Generated Code To Delete Record
I use the dreamweaver generated code to delete a record, how would i add some code to it to delete the files (images) stored in my../images folder, that are linked to the record being deleted, there field names are photo1, photo2, ect..... and there image names are stored in the database Code:

View Replies !
Auto Delete Record/Send Email After X Hours
What I have is a MySQL database which stores records that each have a date stamp on them (2 of them - one for record created date and one for record last updated date), what I want to do is try and have it so that records that haven't been updated in say 72 hours are automatically removed from the database, or the record is updated to set a flag as being out of date, or an email is sent to alert a user of the out of date record etc.

I can easily write the script with the SQL query to check the records by the datestamp and perform the actions needed if the records are out of date, however that requires someone to physically visit that page to run the script and clean up the out dated records. What I want to try and do is have this happen automatically on its own without someone needing to actually visit the page to run the script.

A good example is on eBay how emails are sent to you to let you know when your auctions are about to expire, i wouldnt imagine that eBay would rely on people visiting their website to make those queries run on the database so there must be a way of doing some automated script executio or having a scheduled task run on the server to have a PHP script run each day at midnight or something? Anyone know how to do this?

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 !
Mysql Delete - $query = Mysql_query("DELETE
how would i do the following ?

$query = mysql_query("DELETE notes, datestamp, abs_value, ID FROM absence_mgt  WHERE datestamp='$date' AND ID='$vtc_login' ") or die(mysql_error());
im just getting "Unknown table 'notes' in MULTI DELETE" ?

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 !
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 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 !
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 !
Mysql DELETE
im a stuck again, could some one please tell me why this dosent work;

mysql_query("DELETE FROM messages WHERE from='$fromid', sento='$myid'");

View Replies !
Delete For MySQL
I'm an experienced java/C++/SQL programmer who hasnt used PHP. I'm looking for some generic database access pages for doing dds, edits, deletes, etc., hopefully with some error handling. I'd rather start with a basic shell of code, so I don't have to reinvent the wheel, and can just change connection string, database fields, etc.

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 !
Delete MySql Row By Date
Can someone help me with the following problem:

I have a table that includes a column for "last application date", let's simply call it "date".

Now the problem is how to automatically delete rows where the information in the "date" column has gone old, let's say by -86400 (1 day).

Example: today's date is April 11th, which means that all rows with the info April 10th in the date column would get deleted.

View Replies !
How Do You Do A CASCADE Delete In MySQL?
I'd like to delete a record and all its children records at one time. How
do I do that?

Can you, in one SQL statement,

delete from table 1 where id = 3
delete from table 2 where id = 12
delete from table 3 where id = 12
......

View Replies !
MySQL - Delete Across Two Tables. OT
i cant find the MySQL newsgroup, however i am
hoping to pick up on some expert advice from php/mysql gurus here. I'm
having some trouble performing a delete across two tables.

The tables i have are:

questionnaires (id, name);

questionnaire_questions (questionnaires_id, id, name, qf_type)

The questionnaire_questions table contains a list of questions for a
specific questionnaire (indicated by the questonnaires_id). I would
like to remove a questionnaire, and when doing so all corresponding
questionnaire_questions who have matching id's (questionnaires.id =
questionnaire_questions.questionnaires_id).

I have this statement, however it only works if a questionnaire has
questions... however i would like it to delete even if no questions
exist for that specific questionnaire. The SQL i am using is:

delete questionnaires, questionnaire_questions FROM questionnaires,
questionnaire_questions WHERE questionnaires.id =
questionnaire_questions.questionnaires_id AND questionnaires.id =
THE_QUESTIONAIRE_TO_DELETE_ID

View Replies !
DELETE Problem With MySQL
I've been learning using PHP and MySQL from the tutorial at
freewebmasterhelp.com. Everything works fine, except deleting things.
The script is invoked with a URL like this:

http://www.example.org/test/delete_entry.php?id=35

And here's the script:

<?
include("dbinfo.inc.php");

$id = $_POST['id'];
mysql_connect($server, $user, $password);
$query = "DELETE FROM test1 WHERE id = '$id'";
@mysql_select_db($database) or die("Unable to select database.");
mysql_query($query);
mysql_close();

header("Location: entries.php");
?>

The dbinfo.inc.php file defines the variables $server, $database, $user
and $password. The login part works.

View Replies !
Mysql Delete From A Form
i'm trying to find out how to get this to work. You type in a name of a record in the database and it removes it. In this case it's deleting the record that when you type in the name of the server it looks for it in the column "servername". You type in the servername and it will delete the whole record. Code:

View Replies !
MySQL MultiTable Delete...
I've been able to delete rows from one table successfully but what I want to try next is giving me some problems. I have a users 'id' which is unique. Heres what I want to-do.

DELETE * FROM users WHERE id = 1
DELETE * FROM messages WHERE from = 1
DELETE * FROM comments WHERE user = 1

In each table there oginizaed a little different hense the id , from & user... but thats what I want to-do, without having to-do them all sepreatly, would like it to be efficent. the users ID will be passed along as the var 'id' any thoughts? So pretty much it takes the users id number and deletes them from each table.

View Replies !
How Do You Delete Records From Mysql
Could someone please show me how to delete records from mysql. Maybe even an example in a loop that deletes records based on a criteria.

View Replies !
How To Delete Only Certain Text In A Mysql Row?
I have a table setup that has a column setup as friends and users can add friends to this column no problem.

What I would like to know is how to delete only certain parts of the text of the row/cell where their friends are stored.

The friends text is seperated by the following :

" , "

That is a space on either side and comma in the middle of the space.

I know how to explode the results and put into an array to display the reuslts, but is there a way to delete only one of the friends if the text is as follows.

 , thomas , frank , irene ,

I think you can get the idea.

Is it possible to do this or should I just update the whole cell without the array[$i] result being the friend?

View Replies !
How Do I Delete A Full Row In Mysql ?
how do i delete a full row in mysql ?

View Replies !

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