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 Query : Delete From *


When I use phpmyadmin, and run this sql query, it will tell me that it affected X amount of rows (lets say 10). However, when i run my script, it doesnt' tell me that. Code:




View Complete Forum Thread with Replies

Related Forum Messages:
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 !
Delete Mysql Query NOT USING SUB-SELECT.
I need a DELETE that represent the sql below:

SELECT L.pk FROM t1 L LEFT JOIN t2 F ON F.fk = L.pk WHERE F.fk IS NULL

NOT USING SUB-SELECT.

View Replies !
Give User Mysql Delete Privilege For One Query Via Is This Possible?
What i'm basically looking to do is give a user delete privileges for one query only. This is just so i can keep my database clean. Am i best just writing a DB logon script for that one query only and allowing that user to delete the records or is there a way PHP can grant delete for one query?

View Replies !
Delete Query - Error In Your SQL Syntax; Check The Manual That Corresponds To Your MySQL Server
I have tried to make a delete query but it won't work it gives me a syntax error but I'm unsure where i have gone wrong.... this is what i have got at the moment:

Quote$Deletesoldhouses = "DELETE * FROM soldhouses WHERE SoldHouseID = '$HouseID'";
mysql_query($Deletesoldhouses) or die(mysql_error());

Can any one see what i did wrong?

Error:

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 '* FROM soldhouses WHERE SoldHouseID = '1'' at line 1

View Replies !
Delete Query
Here’s what I’m trying to do:

- Output the last 60 results in my db - works
- Delete a record – does not work

Can anyone see why my delete query won’t work?

It seems to have two problems:

1)   It does not delete a record
2)   The header re-direct says can’t modify header information Code:

View Replies !
Delete Query Successful
How can I test whether a delete query on any other query for that matter has been successful deleting a record. I tried below but it does'nt return if the query deleted a record.

$deletequery= "DELETE FROM details WHERE id='$line[id]'
AND orderid='$orderid'
AND location='".LOCATION."'";

mysql_query($deletequery) or die(ErrorDB($realname)) ;
$message = (!$deletequery) ? 'ERROR' : "<font color='#FF0000'>DONE</font>";
echo "$message<br>";

View Replies !
Simple Delete Query
This code should delete a row from the database where ID = ID however it doesn't seem to be doing its job PHP Code:

<? if(isset($_GET['id']))
{
    
    $query = "DELETE FROM mynews WHERE id = '" . $_GET['id'] . "'";
    mysql_query($query);
    echo "<p align='center'>Deleted</p>";
    
}
else {
     echo "<p align='center'>Not Deleted</p>";
}

?>

View Replies !
Delete Query Not Working As Expected
I have 2 different php forms. One makes sure that a user has chosen an unique user name (below):

$query_rsApp = "SELECT * FROM users where UserName=".$Registered." ";

This Select query works right every time (as far as I can tell). I have a form that I want to use to delete user records.

This Delete query works fine if the username and password are both numeric... But if the username or password is text, it returns the error "UNKNOWN FIELD 'whatever'" where whatever is my search criteria that I am trying to use.

View Replies !
Delete Query Takes HOURS
why on EARTH would this query: Code:

DELETE FROM `test_zip_assoc` WHERE id > 100000

take an entire day when there are 10 million records in this database:


Code:
+--------------+------------------+------+-----+---------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------------+----------------+
| id | int(12) unsigned | | PRI | NULL | auto_increment |
| f_id | int(12) unsigned | | | 0 | |
| zip | varchar(5) | | | | |
| lat_radians | decimal(12,11) | | MUL | 0.00000000000 | |
| long_radians | decimal(12,11) | | MUL | 0.00000000000 | |
+--------------+------------------+------+-----+---------------+----------------+

View Replies !
Find Out If The Delete Query Was Succesful
I'm running some UPDATE/DELETE x WHERE x=y type queries on my db from php. Is there a way to find out if the delete was succesful or if there was some kind of error i.e there were no instances of x=y in the table.

View Replies !
Insert, Delete, Update And Query Data Via DBX
can someone guide me how to connect to mysql using DBX and whats the syntax on inserting, delete, update and query data.

View Replies !
Nest One Mysql Query Within Another (for Cross Referencing Another Table In The Middle Of That First Query)?
How do i nest one mysql query within another (for cross referencing another table in the middle of that first query)? for example:

i am referencing a table with news posted by members and in the middle of that reference i want to reference an up to date version of their email address as listed in their profile (in case they change it after posting a news message).

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 !
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 !
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 !
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 !
PHP Unlink() & Mysql Delete
Im trying to delete a file, then delete the row in my table that holds the info for this file. I tried the code below and got this error:

Parse error: parse error, unexpected T_STRING in /nfs/cust/4/97/13/731794/web/Admin/backup/PXS_DeleteBackup.php on line 34


Here is my code:

View Replies !
Mysql Row And File Delete
I have a database with the following colums, imageID, imageName, imageDesc, imageFile, imageHeight, imageWidth, imageThumb, imageThumbHeight, and imageThumb Width. I can easily delete a row from the mysql table, galImages, but I also want to delete two files from a directory. The file names are stored in the columns imageFile and imageThumb.

View Replies !
Delete MySQL Data
I am building a lunch ordering system for a company. The employees can login, order lunch, and the administrator can see what everyone ordered for lunch in the admin panel. The problem is that when the employees enter data, it stays in the database until they update it. If an employee is sick, their lunch order from the previous day is still in the database. Is there a way to clear those values they enter at a certain time in MySQL.

View Replies !
Delete Duplicates In MySQL
I have a database in MySql which has 2 fields. The 1st field is called id which is the primary key. The 2nd field is called full_add where there are some duplicates.

I would like to delete all the duplicates in the full_add field leaving only 1 record behind.

It does not matter if the corresponding primary key gets deleted as well because the primary key is not related to any other table or database. I prefer not to use temporary tables or create new tables because my webhost does not allocate much memory to me & my database is quite big.

View Replies !
How To Delete MySQL Database.
I've got three hostings with the GoDaddy hosting service. The hostings are supposed to provide only one MySQL database each. I've just recently noticed in the phpMyAdmin program that separate databases, each with the name "test," has appeared in two of the three hostings.

I don't know how they got there. I didn't put them there. I contacted GoDaddy's technical support. They said that the "test" databases automatically comes with the phpMyAdmin program. Of course, that's not right. Anyway they said that I could delete the extra database without damaging anything.

View Replies !
MYSQL/PHP Delete Script
Im having problems getting my delete script to work it comes back with: Delete Error: Unknown column 'EVANS' in 'where clause' so it is using the surname i input as the column name but why?

View Replies !
Mark A Row In My Mysql Database As To Be Delete
Is there a way in php that I can mark a row in my mysql database and then later so delete these rows that have been marked?

View Replies !
Php/mysql Insert, Update, Delete All-in-one
I have a check box form in an admin area, that links various related tables into one.

These check box results are stored in an array, and then looped, there are in fact four groups of arrays, but the array length could become large (i.e. dozens - not hundreds)

The issue I have is that from the one form multiple things need to occur.

- If a box is checked and the record doesn't exist a new record needs to be inserted.
- If a box is checked and the record does exist, it should be ignored (as it already exists).
- If the box is unchecked and the record exists, it should be deleted.
- If the box is unchecked and the record doesn't exist it should be ignored (the record doesn't exists).

I'm looking for the logic and process (rather than being hand fed code ) Can this be done with 1 (or more likely 2) sql statements. Or do I have to loop thru the arrays, checking the existance and then applying a specific sql statement depending upon checked status and the records existance. Someone mentioned using IF() in the sql statement, but I am not familiar with that one.

View Replies !
Delete Row From Mysql Only Deletes The Contents?
mysql_query("DELETE FROM cart WHERE ItemId=$ItemId");

There is the code but the result in my databse is that the ID number changes
from, lets say, 77 to 78 with 78's contents being empty. Therefore when I
look at the results - the deleted ID77 is gone but now I have ID78 with no
content!

Does anyone know why and how do I make it stop?

View Replies !
MySQL DELETE: How To Get Page To Refresh?
I have a script that deletes records in a table. It works fine. However, it redirects the browser back to the page and the record stills shows there. Only after the page is manually refreshed does it disappear.

I've used both header("Refresh...") and header("Location...") to accomplish the redriect, but no dice. The only thing that seems to work is if a unique URL is pushed into the address bar, which I do by appending md5(microtime()) to the end of the redirect URL.

View Replies !
Select & Delete Mysql Queries
i've try to insert and delete record at the same page, but it only can insert and can't delete the record. when i click submit button from the previous form, the record is insert into table B and delete from the table A. is the code correct? Code:

View Replies !
Delete Data From MySQL Database
I am new to PHP and MySQL but I have setup a MySQL database. I can view the information in an HTML table using PHP scripts and can delete an entry form the database table, but what i need to do is to be able to delete an entry by selecting a radio button next to the relevent information however when i try to add a form in the PHP script i get an error.

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 !
Time Limit To Delete From Mysql
on my site i allow users to upload .doc, .pdf and image files, over time these files will build up on the server and take up a bit of space, i was thinking of adding a "clean up" button in the admin section where files/users older than a certain time are deleted from mysql and the files (unlinked) can anyone advise me on the best way to acomplish this. i know i need to query the database then find all files uploaded (say after 28 days for example) is that on the right track or is there another way at all?

View Replies !
Delete Issues MySQL 4.0.25-standard
<?
include("../../includes/global.inc.php");
mysql_connect($glob['dbhost' ],$glob['dbusername' ],$glob['dbpassword' ]);
@mysql_select_db($glob['dbdatabase' ]) or die( "Unable to select database");

$query = "DELETE FROM testimonials WHERE id LIKE '$id'";

mysql_query($query);
echo "Record Deleted";
mysql_close();
?>
<META HTTP-EQUIV="refresh" content="0;URL=admintestimonials.php">

the issue is that it is not deleting the record. the $id is an echo from another page. I can see that it is echoing the id number just does not delete the record. any ideas?

View Replies !
How Do I Delete From Table After Sorting? MySQL
I want to sort column X from largest to smallest, but I want to delete all the entries from all rows after the 25th place.

View Replies !
PHP Update Query Mysql: Query Succussful?
I can't seem to successfully test an update query. Below is a piece of code that updates a statistics table. If row today doesn;t exist, a new day must be created. But this doesn't work...

thank you for your reply.

$today= date("Y-m-d");

$qq="update totals_r set hits_r=(hits_r+1), lang_$lang=(lang_$lang+1), cat_$cat=(cat_$cat+1), rating_$rating=(rating_$rating+1), bussite_$bussite=(bussite_$bussite+1) where date='$today'";

$result_6 = mysql_query ("$qq");

if (!$result_6){ /// IF !ROW_TODAY ==> CREATE NEW DAY

$qq_2="insert into totals_r (hits_r, lang_$lang, cat_$cat, rating_$rating, bussite_$bussite, date) values(&#391;',&#391;',&#391;',&#391;',&#391;','$today')";

$result_6_2 = mysql_query ("$qq_2");

if (!$result_6_2){
$err_msg_sql_6= mysql_error();
$err_loc_6="$PHP_SELF"." // Query6: update totals_r";
}
}

View Replies !
Query - Create The Mysql Query To Get All Fields
I've a table "article".
Any article is of a type in table "type1" or "type2"
Each type may be of a model in table "model1" or "model2".
Each model can be on a certain make, also in 2 tables, "make1" and "make2".

they are a few possibilities.
"article" can be of "type1" or "type2"
"type1" can be of "model1" only - "type2" can be of "model1" or "model2"
"model1" can be of "make1" only - "model2" can be of "make1" or "make2"

"article" has "type.id" field (char10). If it start with "my" then it's a
"type2", otherwise is a "type1"
"type1" has only "model1.id" field. "type2" has "model1" and "model2"
fields. If one is filled, the other isn't
"model1" has only "make1.id" field. "model2" has "make1.id" and "make2.id"
fields. If one is filled, the other isn't

so here are the possibilities:
article -> type1 -> model1 -> make1
article -> type2 -> model1 -> make1
article -> type2 -> model2 -> make1
article -> type2 -> model2 -> make2

Now, I must create the mysql query to get all fields given the "article.id".
Is it possible ?
How ?
will this work ? in pseudo-code

article left join type1 articleid = type1id
inner join model1 type1id = model1id //inner because if type1, the model is
1
inner join make1 model1id = make1id //inner because if model1, the make is 1
left join type2 articleid = type2id
left join model1 type2id = model1id
left join model2 type2id = model2id
left join make1 model2id = make1id
left join make2 model2id = make2id

View Replies !
Delete Textfile List From MySQL Table
I have a list of email addresses that I need to delete from my database and they are in a textfile, one on each line like below...

a@b.com
c@d.com
e@f.com

etc. does anybody have a snippet of PHP code that I could use to accomplish such a task?

View Replies !
PHP File To Delete Multiple Talbes In MySQL
i installed PHP Nuke, didnt really like it. I think its much more then what I need. Great System, just think alot of it is useless for my needs. In any case i want to delete all the tables it created in my DB. Anyone got a script I can run to delete all tables that start with.

View Replies !
How Do I Delete Selected Rows From MySQL Table?
I am trying to figure out how to delete selected rows from a MySQL database table. The web site that I am working on has a page that will extract rows, using the "SELECT * FROM .. etc." statement from a database and output them in a table - like the one below (bottom part). I've got that part figured out.

What I am trying to figure out is if the user puts a checkmark in one of the checkboxes (below) how would I write the PHP code to delete one or two of the rows from the MySQL table? PHP Code:

View Replies !
How To Delete A MySQL Database Table Without System()
I want to delete a MySQL table without using functions of the OS, so
that my php script can run on any webserver. Can I use a command like

$sql = "DELETE FROM tablename";

or are there better ways to do the job?

View Replies !
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 !
Automatic Delete From MySQL Database Table Expired Records?
I have a question . . .

how can i delete from MySQL database table automatic expired records ?
?

One think is to make a service that deleting the expired records . . .

Any other method ?



View Replies !
Script To Read/write/amend/delete On The Tables In A Mysql Db
Running on a unix box and looking for a good (free!) php script I can use to read/write/amend/delete on the tables in a mysql db. Been searching for a while but can seem to find one with a good web front end to use.

View Replies !
MySQL Query - 2 Steps In 1 Query?
I have two tables and the first one contains 2 main fields- 'user_id' and 'username'. The second table contains 2 main fields- 'poster_id' and 'message'. And what I need to do is lookup the user_id from the first table with the username, then pull * from the message_table if the poster_id matches the value pulled from the first table.

Now, I got this working without a problem at all but I had to use 2 queries to do it (1- pull the user_id from the first table by matching it with the username, then 2- using the first id, pull everything from the second table that matches it). Is there an easy way to do those 2 steps in 1 query? I know there must be some way since this seems like a fairly simple and routine problem, but I can't find it online or in any books I have here.

View Replies !
Count Query In Mysql Query
Is it possible to retreave all data from 1 table. and count a number of records where 1 row has the same number as id of the main table? example

Table categories
id name
1 blah
2 hello

Table Threads
id name categoryid
1 first 1
2 mid 2
3 noon 1
4 blah 1
5 roar 2.

View Replies !
Simple Login Page To Delete And Edit Things In Mysql Database
How do I build a simple login page on my site? I need a way to login to my admin area in my webshop, so I can add, delete and edit things in mysql database. I don't need help with add, delete and change things, only the login thing.

The users should not even know that there is a admin login page. The users don't login to shop, they just shop so I can't use the user login page because there is no such page. Can someone please give me some guidelines for this?

View Replies !

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