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.





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

Related Forum Messages:
Delete Function That Deletes A String Of Text
I am trying to fix my delete function that deletes a string of text that may or may not have single, double quotes, pound signs etc.

function delete_bm($user, $url)
{
// delete one text string from the database NOT a url as would be suggested
if (!($conn = db_connect()))
return false;

// delete the Item
if (!mysql_query( "delete from XMAS_WISH_LIST
where username='$user' and XMAS_ITEM='".mysql_escape_string($url)."'"))
return false;
return true;
}

When I run this on my web page, I don't get an error, it just does not delete the item that I am passing it, like the following: "test" (with quotes).

Any suggestions?

View Replies !
Delete Folder And Its Contents
is there any way of deleteing a folder and all of its contents using PHP?

View Replies !
Delete File Contents
Can someone post some code to show me how to delete a file from a folder please? I need to delete a file first, and then upload something in it's place. Maybe a bit of code to slide in what i have already would work? Code:

View Replies !
Delete Table Contents?
ive got a table thats too big to dump the records in myphpadmin, how can i dump all the fileds (i think there are 4 or 5) but keep the table and fileds intact to be used again?

View Replies !
Delete Column Contents
Is there a way, through PHP, to delete the contents of a column without deleting the actual column. I know I could do it by deleting the column and adding it again but just wondering if there's a more efficient way.

View Replies !
Delete Entire Folder Contents
What is the best way of deleting an entire folders contents in php I looked at this, but not sure exactly how to implement. http://uk.php.net/manual/en/function.unlink.php

I dont want to get involved with something that could mash my system if I get it wrong.

View Replies !
Script To Connect To Delete Contents Of A POP3 Mailbox
I have written a PERL script that I can run through bash, that will take in a mail server address, username and a password, login and then delete all of the mail contained within the user's mailbox.

Now I've battled to create a web interface so that my non-linux colleages can use easily wherever they happen to be, but just cannot get to work.

So, I decided it would be easier to use PHP to create the script and use $_POST to grab the address, username and password from a form and then process the connection/deletion.

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 !
Have A Cookie That Deletes Itself
Is there a way to have a cookie that deletes itself when you leave the site. IE: You log into an index.php. You then view add.php, delete.php, view.php, search.php, finishing off with member.php?userid=12, then you leave the site. Is there a way to set a cookie that doesn't expire until you leave the site?

View Replies !
Deletes The Comment Data
I have a table with data, and another table that comments on that table. Basicly is a forum. I need some code that deletes the comment data if the main data doesnt exist?

View Replies !
Deletes Every Cookie Set For The Specific Domain?
I've been working with cookies and have made errors in setting them causing them to make weird things happen on my site. Is there a way that for a user going to a page, it deletes every cookie set for the specific domain?

View Replies !
Script That Deletes Records That Are An Hour Old.
I am trying to write a script that deletes records that are an hour old. However, I am working on this project with somebody else and they don't use unix timestamps like I am used to. Rather, they use the SQL timestamp (2007-10-02 07:51:00) method. How would you write a query that does what I am looking for? Also how would I write a query that tells me the time left before expiration?

View Replies !
How Can I Deletes Files Whose Filenames Are NOT Stored In The Database.
I have a folder containing .jpgs files. I also have a table in the database containing filenames of files I want to keep. How can I deletes files whose filenames are NOT stored in the database. Here's the code I use to list files in the database: Code:

View Replies !
Searching MySQL DB Contents
I'm implementing a simple internal search for a site that will select articles containing specified words from a database. However, I am finding LIKE to be somewhat limiting. eg. SELECT title FROM articles WHERE content LIKE '%test%' - this returns all articles containing words test, testing, testosterone etc. Not what is required. eg.

SELECT title FROM articles WHERE content LIKE '% test %'
- this returns only articles containing the word test.

However, the latter will not pick up on the word 'test' at the very start or very beginning of the field, or when immediately prefixed or suffixed by some punctuation.

I've found that using SELECT ..blah .. LIKE '%[^a-z]test[^a-z]%'

should overcome the problem of having punctuation on either side of the search term. 've had no success with this however, and it still doesn't get around the problem of the word occuring at the start or end of a field. Does anyone have any suggestions or experience in searching for words in a DB in such a way?

View Replies !
Check Contents Of Mysql Table
ok, so now that I've figured out how to allow users to upload files (with help!) I'm trying to run a script that will check the name of the uploaded file and determine if that file name already exists in a specific mysql table. Here's what I've got so far:

$filename = $_FILES['uploadfile']['name'];

$query = "SELECT * FROM $table";
$result = mysql_query($query, $conn);

while ($checkfile = mysql_fetch_assoc($results)){
$existfile = $checkfile['filename'];
}//end while

if ($existfile == $filename){
print "A file with that name already exists.";
}
else {
some script that adds the file info to $table
}

Now, this combination of while and if statements will only catch a match with an already existing filename if the already existing filename was the last one to be updated. I've tried adding the if and else statements into the while statement but then the file info gets added to the table multiple times. Does anyone have any ideas? Am I even making any sense?

View Replies !
E-mail Contents Of Mysql Databse NOT
I have have tried to find the answere to this on line but without success!

I have a table called cart. In cart I have a column called ID. What I need
to do is take this code:

<?php

$result = mysql_query("SELECT * FROM cart WHERE cartId='$ID'");

<?php echo $row["ItemNo"]; ?>
</font></td>
<td width="22%" height="6"><font face="verdana" size="2" color="red">
<?php echo $row["Name"]; ?>
</font></td>
<td width="14%" height="6">
<div align="center"><font face="verdana" size="1" color="black">
<?php echo $row["Quantity"]; ?>
</font></div>
</td>
<td width="7%" height="6" > </td>
<td width="10%" height="6" >
<div align="left"><font face="verdana" size="1" color="blue"> $
<?php echo number_format($row["Price"], 2, ".", ","); ?>
</font> </div>
</td>
<td width="7%" height="6">
<div align="left"><font face="verdana" size="1" color="blue">
<?php
$Cost += ($row["Quantity"] * $row["Price"]);

?>
<?php
$ItemCost = ($row["Quantity"] * $row["Price"]);

View Replies !
Mysql File Contents Upload
I am trying to upload the contents (bookmarks/favorites) of the file that is generated from exporting a browsers bookmarks. I want to get the contents of the file and import them in the apropriate fields in a mysql database eg. 'www.phpbuilder.com' in the URL field, the 'site title' in the TITLE field and so on...

View Replies !
Read Contents Of An External XML Page And Then Parse Its Contents
I have a URL that generates an XML page. I'm trying to read its contents and parse the information. But, I keep receiving these error messages: Code:

View Replies !
Counting The Contents Of Multiple MySQL Rows
Ok, I'm working on a poll for my site, which uses a mysql db.. I need my script to count the number of votes total, so I can take a percentage out of the total number of votes..

The table has the following rows.
vote_id | vote_option_id | vote_option_text | vote_result


I need to add up all the numbers under the "vote_result" columns.. but I hardely even know where to begin.

View Replies !
Updating A Mysql Row's Contents, Not Adding A New Row
I want to make it so that when someone enters text into a form, the text is entered into a mysql database. However, the way I want it to work is, when the person enters text into that field at a later date, it updates it instead of adding another row in the db.


View Replies !
Read The Contents Of A Text File Into MySql Using PHP
New to this, have the basics, can build a form and such. My problem is I
need to be able to open a file on a pc/s on the network, read the data
character by character, check to see if a certain character is present, if
it is, update the database and continue reading the file until it comes
across the character again, updates the database and so on . . . .

View Replies !
MySQL Dump Table Contents Problem
my only problem is getting it to actually dump all the contents to my "go" table. And if you don't want to read the code then what I'm doing is dumping the table contents on the last day of the month. 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 !
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 !
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 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 !
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 !
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 !
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 !
Merge The Contents Of One Array Into The Contents Of Another.
There are many times when I need to merge the contents of one array into the contents of another. Below is how I make this happen now. Do you know of a better or quicker way to do this? The main reason I am concerned is that the arrays I'm merging now have 40,000+ items in each array. I want to streamline the process if possible.

$arrayA = array('item0', 'item1','item2');
$arrayB = array('item3', 'item4', 'item5');

for($i=0;$i<count($arrayB);$i++) {
     $arrayA[] = $arrayB[$i];
}

print_r($arrayA);

View Replies !

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