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 Item From Database


I still can't figure out how to delete an item from my shoppingcart. I have tried different ways to do this, but its impossible.

-a button or link that deletes a item from my database
-the php script that deletes it

here is a suggestion:

$slett = "DELETE ID, VARE, MODELL, STR, ANTALL, PRIS,
TOTALPRIS FROM USER_TRACK
WHERE USER_ID = "$user_id"";

But how can i assign this to a button?




View Complete Forum Thread with Replies

Related Forum Messages:
Delete Item From Array
How do I search for an item within an array, then delete it?

View Replies !
How Can I Get A Checkbox To Delete A Item
how can I use a checkbox to delete multiple items with how I did this php? Code:

View Replies !
Delete An Item From An Index Array?
How can I delete an Item from an index array in php4?

View Replies !
Listing Table Data With An Option To Delete Each Individual Item.
Was wondering if anyone could help me with a PHP, MySQL problem. I am
completely new to PHP and MySQL. I have been trying to find a way to
list data from a table on a web page and after each individual item
have a hyperlink to allow users to delete the information listed. Can
anyone help?

i.e.
Name Age Sex
------------------------------------------
Adam 21 M delete
Betty 22 F delete
Chris 23 M delete
Daisy 24 F delete

------------------------------------------------------------------------------------------------------------------------------
(delete after 'Sex' would be the hyperlink to delete that entire line
(row) from the table).

View Replies !
Get One Row, One Item From Database
I was trying to grab just one row and one field in that row from MySQL, but couldn't find a way other than: PHP Code:

View Replies !
Search Item In Database
I made a function that does a case insensitive search. This works fine.
But i'd like to improve that script so that it also returns items from the database that are partly similar to the search string.

this is the script atm:

View Replies !
News Item From Database
I'm trying to get a news item from my database that happened one month ago.

PHP Code:

SELECT COUNT(np_id) as news_headline, news_date FROM news ORDER BY news_date

What do I need to do in a WHERE clause to get only news items from that date one month ago?

View Replies !
How To Remove Unwanted Words/characters From Database Item
currently i dump some data into our database from another database. now, i found some wierd characters  at the end of each of those items. and there are like 500 items in my database table which has those.

is there a way that i can remove it using mysql query to be run in mysql or phpmyadmin
something like
update * from table where field name item has  and replace it with just blank?

hope you could help me with this.

View Replies !
Write A Conditional Statement To See If The Current Item In An Array Is The Last Item.
This seems like it would be so simple, but I haven't been able to solve it. I want to write a conditional statement to see if the current item in an array is the last item. I tried

if (count($array) == (current($array))

but that didn't work. count($array) will give me the number of items in the array. What do I use for the current position in the array.

View Replies !
Array_unique - How-to Get First Item Value In Repeated Array Item
I would like to know how-to get the first value of repeated items too in an array using something like array_unique. Code:

View Replies !
Session Handling - The Item Hasn't Been Purchased But Also Hasn't Been Put Back In The Database.
I've developed a shopping cart with PHP and MySql which works fine. Once an item is added to the cart it is withdrawn from the database instead of leaving the withdrawing till the checkout stage. This avoids shoppers all choosing an item that may be the last in stock. The only problem is if the shopper that has the item in their cart decides not to buy and leaves the site without removing the item from the cart or the session times out, the item hasn't been purchased but also hasn't been put back in the database.

View Replies !
Delete From Database
I have code that does not delete from a database. The same code (cut an
paste in the same file, but different function and having a different query)
works. So, of course, I tested the query interactively. I echoed the query
and did a cut and paste when interactively connect to the database. That
one worked so it isn't the query since interactively it is seeing exactly
the same thing as the code produces.

Here is the code:

function deleteCatalog($catalog) {
$query = "DELETE FROM CatalogNames WHERE sCatalogID='" . $catalog . "'";
mssql_select_db($database_Login, $_SESSION['Login']);
$result = mssql_query($query, $Login);
...
}

The $query echos:
DELETE FROM CatalogNames WHERE sCatalogID='CMP'

As an example of code that works (in the same file)
function addToCatalog($cat_id, $cat_name) {
$query = "INSERT INTO CatalogNames (sCatalogID, sCatalogName) " .
"VALUES ('" . $cat_id . "', '" . $cat_name . "')";
mssql_select_db($database_Login, $_SESSION['Login']);
$result = mssql_query($query, $_SESSION['Login']);
...
}

The second and third lines are identical (cut and pasted) as in other places
in the same code. In fact, it is only in this file that I do all the
database work. Every other function works. This is the only delete,
however.

View Replies !
Delete Database
using php and mysql how can i tell the my website to move any entry older than 30 days to a different table and then delete it below i have some script i did try but this doesnt work (im using unix timestamp incase that changes anything)

mysql_query("
INSERT INTO newsarchive (id, postdate, title, newstext)
SELECT id, postdate, title, newstext FROM news WHERE postdate < DATE_SUB(curdate(), INTERVAL 30 DAY)");

mysql_query("DELETE FROM news WHERE postdate < DATE_SUB(curdate(), INTERVAL 30 DAY)");

mysql_close($link); //clean up

View Replies !
Recursive Database Delete
I have two tables in my database, one for the folders, where each folder has a parent id and an id itself, and one for the files where each file has a parent id for the folder its in. Now If the user deletes a folder, every file and folder within it, no matter how many there are, should be deleted. Can anyone give me the idea?

View Replies !
Delete Row In Database By A Selectbox?
I'm having a world of trouble with this. I have a selectbox of names....when they selectone and hit delete I want it to delete it from the database. I dont think i'm getting any value from the select box. Here is the code I have : PHP Code:

View Replies !
Delete A Row From A Database Table
I'm trying to delete a row from a database table.  I've made a connection yet it's not working.  Is there something wrong with the following code?

mysql_query("DELETE * from  `contactinfo` WHERE Submission_Number = 1 ");

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 !
Delete Data From Database
Let's say i have two tables,

table_one;
userid,userinput,indexno

table_two;
cond,qant,amp,indexno

the indexno in table_one and table_two are the same.if i choose to delete one row of data in table_one,i want the data with the same indexno in table_two be deleted as well.
how can i achieve this?

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 !
Database Auto Count What About Delete?
I have a table that give a unique ID to certain Articles.
To give the ID i simply use the Auto count of the DB.

But what happens when i delete a record? i am now missing an ID.
How can i insert a row and give it the first available number?

For example ID 1, 2, 4, 5, 6

i would Insert and set the ID number to 3.

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 !
How To Delete Multiple Entries From Database?
I ran this script Im working on twice by accident which caused a ton of duplicate entries. I dont want to start over so how would I delete multiple entries in a database?

View Replies !
Database Update/edit And Delete
i have spent the last few days trying to create a simple script to add/edit and delete entries in a mysql database with php. i have 1 database with 40 tables, each table has 3 fields (id, header and body)

i created an input page with input fields for header and body. the table to store the information in is selected from a drop down menu. all this works fine.

for some reason i cannot get the edit and delete page top work at all. would someone mind taking a look at the code and let me know what i am doing wrong? Code:

View Replies !
Delete From Flat File Database ?
I have recently started to code a Flat file database (just for fun) and it's going fine, but I was wondering whats the best way to delete a line from the file.

I have this code below and I would like to add a delete button besides each line, which would obviously delete that line. But I do not know the best way to go around doing this as I don't know any specific functions to use. 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 !
How To Delete All Database Entires Older Than 30 Days?
One of the fields in my database is called ad_date which is of date type and stored dates int he format YYYY-MM-DD. I would like to perform a DELETE SQL statement in my PHP script which deletes all records with an ad_date value older than 30 days.

I knoy this is also an SQL question, but it is the 'older than 30 days' part which I'm stuck with and so figured it would be better in the PHP forum as I think I need to use PHP to calculate todays date - 30 days.

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 !
Simplify Insert-update-delete From Database
I'm looking for some functions or objects allowing to
select-insert-update-delete from any table in a mysql database without the
need to create a new query every time. Example:

selectdatas(array('field1','field2','fieldn'),arra y('table1','tablen'),array('left
join,idy','inner join, idx'))

then the function build the query, execute it and then return an object with
the query result.

I must build a database driven site that is 90% of the time spent on
building queries. If I may avoid build them manually it will help me a lot
and let me gain some days of programming.

View Replies !
DELETE TimeOut Issue On A Large Database
When I run the script below, it results in a timeout. Running the commands through phpMyAdmin, results in a timeout too.

Table1 has 40,000 records and Table2 has 35,000 records. I run the script to get rid of the duplicates.

Is there a way that I can check for duplicates without the timeout issue? I tried the while loop through PHP and that results in a timeout too. Code:

View Replies !
Delete Database Base On User Choice
i want to let user delete their data from database. Note: one user may have more than one rows of data. table as following;

TCid UserName Topic Content
1 q1 aa aa
2 q2 aa aa
3 q3 aa aa
4 q1 aa aa
5 q2 aa aa

And i code as following steps;

1) ask user input user name

2) Display out all the data which the users got. (it is in delete.php file.)
in here, i will use the check box, to let the user choices which data they will delete.
note: i will try to make the Cid relate with the input name, so later on i can delete
the data base on Cid.

3) i will delete the data base on the user choice(it is in deleteR.php file).
but at the movement, i just want to test where i can get the value of the TCid or not
(because i will delete some datas base on the TCid which the user choiced).

The problem i go now, it is from the step 3, i could not get the TCid's value out,
that's mean, i could not delete some data base on the user choiced. Code:

View Replies !
Delete Multiple Records In The Same Database Querie?
I have some code that deletes records from the database, in a loop. However its prety inificient as it makes a seperate database call in every loop whcih is slow. PHP Code:

for ($i=0; $i<count($idarray); $i++)
          db_query("delete from clicks where id='$idarray[$i]'");

Is their a more efficient way of doing that? It is posible to delete multiple records in the same database querie?

View Replies !
Database Delete Repeat Records And Add Up Totals
I have a database full of order records for our website. My goal is to delete people from the same 'address' field and add up the 'total' into one record. Can i get some example code on how this would be done?

View Replies !
It Wont Delete The Entry From The Database. The Page Just Refreshes?
It wont delete the entry from the database. The page just refreshes? Code:

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 !
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 !
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 !
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 RECORDS - Database Adding New Records
iv got the database adding new records, and now I want it to display all of the records that are there buy name and id number, then i want u to be able to type in the id number of the customer u wish to delete and it shoudl delete it, sounds good buts its not actually deleting the record. it says it does, but its not doing it. Code:

View Replies !
Iterator First Item?
Let's say I have the code:

foreach($data as $row)
{
do something with each $row
}

Is there a way to do something specific to the first item iterated?
Pseudocode:

foreach($data as $row)
{
if first time through iteration do something with $row
else do something which each remaining $row
}

Is this possible? I think I could use a regular 'for' loop, using the
length of the $data array as a guide, and then an 'if..else' structure
to see if it is the first time through the 'for' loop, but I was
looking for a more elegant solution.

View Replies !
Trying To Split The Item...
I'm trying to make a search thru my mySQL database, so it any keywords are found then I'm adding the details to the next item in an array that I create. I've tested the array and it is storing the information into the array properly because it echoes out all of the information correctly. My problem is that, at the beginning of each item in the array I have information that tells me what part of the database it was pulled from and the id number and also how many times the a keyword was found in that specific database entry. So you have something like this.. Code:

View Replies !
Get Last Item In URL String
I realize how elementary this is, I apologize. Maybe that's why I can't find the right answer. I've tried everything from EXPLODEing the string to SUBSTR_REPLACE.

Can anyone tell me how to just get the last item in a URL string? Like turn this:

/mydirectory/myimg.jpg

into this:

myimg.jpg

View Replies !
Most Recent Item
I have a table with every post in - which has a column for the time the post was created and a column for the thread that this post is located in. My threads table has a column for which forum this thread is in and a column for whether the thread is a sticky or not.

On the forum display page, I'd like to display every thread that is in that forum, but ordering them so that any Sticky threads show first (ordered by date created), and then the non-sticky threads are displayed after those ordered according to the time of the most recent post within that thread.

View Replies !
Help With Featured Item
if its possible to display a featured item from mysql table.

Table , links (id, item, hits)

How i could i display 5 links which have bigest numbers ? Is this possible ? I only need query sample, not the entire code.

View Replies !
Pulling One Item
I have a MySQL database with info stored in it (speakers at a weekly seminar). I want to display the seminar's speaker info on my webpage every week. I need it to roll over to the next week's speaker every Thursday at 1:00. I have no clue about where to even get started with this. any ideas?

View Replies !
Item In Array
I have an array, set up like this:

$this->navigation_array['Home'] = array('text' => 'Home', 'act' => 'Home', 'redirect' => 'No', 'active' => 'Home', 'link' => 'index.php?act=home', 'default' => 'Info');
$this->navigation_array['Forums'] = array('text' => 'Forums', 'act' => 'Forums', 'redirect' => 'No', 'active' => 'Forums', 'link' => 'index.php?act=forums', 'default' => 'Info');
$this->navigation_array['Users'] = array('text' => 'Users', 'act' => 'Users', 'redirect' => 'No', 'active' => 'Users', 'link' => 'index.php?act=users');
$this->navigation_array['Config'] = array('text' => 'Configuration', 'act' => 'Config', 'redirect' => 'No', 'active' => 'Config', 'link' => 'index.php?act=config');

I want to find the first item inserted into the array, namely "Home". What is the fastest way to just call the first entry? You cant use $this->navigation_array[0] in this case because the keys are text not numbers.

View Replies !
How To Display One Item Only
Hello, in my query I return

date1 item 1
date1 item 2
date1 item3

date2 item4
date2 item5

how can I make it display

date 1 item1
item2
item3

date 2 item4 item5

View Replies !
Get A Person's IP When They Add An Item?
Is there a way to get a person's IP when they add an item? I have a voting system on my site, but I've had a few people "stuff the ballots" and want to track IPs. How can I do this easily.

View Replies !
Activate An Item
I have a table with some items in it. Only one of them is active. On a page I display them all and you can click to activate one, the id of that one to activates is posted. What's the best way to activate that one and to deactivate the current active one? Now I use three queries: look up the current active one, deactivate it, activate the new one. I think there is a better way to do this.

View Replies !
Return Last Item
How can I return just the last item of an array? For example: PHP Code:

$mytest = explode(",", $example);

In one case: PHP Code:

$example = "milk,eggs";

PHP Code:

$example = "eggs,shampoo,batteries";

View Replies !
How To Make Url Links To An Item
Hi i was wondering if anybody could tell me how to make url links to an item in my site from a list of search results. Here is a piece of my code:

<?php
$Name = $HTTP_POST_VARS["query2"];
$Eventtype = $HTTP_POST_VARS["query2"];
$EventStart = $HTTP_POST_VARS["query2"];
$EventEnd = $HTTP_POST_VARS["query2"];
$VenueName = $HTTP_POST_VARS["query2"];
if($Name or $Eventtype or $EventStart or $EventEnd or $VenueName)
{

$conn=@mysql_connect("mysql", "u0rr")
or die("Sorry can't connect to database");

$rs = @mysql_select_db("u0rr", $conn)
or die("Sorry can't connect to database");

$sql="select * from event left join venue on
(event.VenueID = venue.VenueID)
where (Name like '%$Name%'
or VenueName like '%$VenueName%')
AND Eventtype = 'Comedy' ";
$result=mysql_query($sql,$conn);

while( $row = mysql_fetch_array($result) )
{
echo("<b>"." Event Name: "."</b>".$row["Name"]."<br>");
echo("<b>"." Event Type: "."</b>".$row["Eventtype"]."<br>");
echo("<b>"." Venue Name: "."</b>".$row["VenueName"]."<br>");
echo("<b>"." Event Start: "."</b>".$row["EventStart"]."<br>");
echo("<b>"." Event End: "."</b>".$row["EventEnd"]."<br>");
echo("<b>"." Availability: "."</b>".$row["Availability"]."<br>");
echo("<b>"." Description: "."</b>".$row["Description"]."<br><hr>");
}
}
?>
For example if i enter an event type as 'comedy', a list of search results will come up from the form input displaying comedy events. Now from these results i would like to be able to click on Venue Name and this would link to that page in another part of my site.

I hope this explanation is o.k, if not post a thread & i'll try and explain a bit better. Thanks for any help

View Replies !
Deleting An Array Item
I have a standard array:
$foo = array(
0 => 'abc'
1 => 'def'
2 => 'ghi');

and I have a variable, $bar, which equals 'def' ... and I want to check
my array to see if the value of $bar exists in the array, and if it
does, delete it from the array.

if (in_array($bar, $foo)) {
// what goes here???
}

I've done this before, but for the life of me, I'm drawing a blank now.
Help a bruthah out?

View Replies !
Random Item Of An Array
What is the best way of picking out a random item of an array, regarding speed and CPU-usage ? I need a super fast way of picking out an ID from my MySQL db.

View Replies !

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