[SOLVED] CANNOT DELETE...help!!!!

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
apek
Forum Commoner
Posts: 96
Joined: Tue Jan 06, 2004 11:19 pm
Location: Holiday Plaza Johor Bahru

[SOLVED] CANNOT DELETE...help!!!!

Post by apek »

why can't i delete my data in mysql???
this is my query:

Code: Select all

<?php
$viewall=mysql_query("DELETE komponen,jumlah FROM tempkomponen");

?>
and then i try to delete via phpmyadmin,and then this error showed up:

Code: Select all

Error

SQL-query : 

DELETE komponen,
jumlah FROM tempkomponen

MySQL said:

Not unique table/alias: 'komponen'
this is my table structure:

Code: Select all

CREATE TABLE tempkomponen (
  id int(11) NOT NULL auto_increment,
  komponen varchar(50) default NULL,
  jumlah int(11) default NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;

pls help...
User avatar
apek
Forum Commoner
Posts: 96
Joined: Tue Jan 06, 2004 11:19 pm
Location: Holiday Plaza Johor Bahru

.........

Post by apek »

anyone??? :roll:
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

What are you really trying to do?

DELETE rows from a column?
ALTER a column in a table?
DROP a column from a table?
User avatar
apek
Forum Commoner
Posts: 96
Joined: Tue Jan 06, 2004 11:19 pm
Location: Holiday Plaza Johor Bahru

Post by apek »

hi...
i just want to delete all the datas in the table...
not dropping them...
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

DELETE *
FROM table
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Code: Select all

DELETE *
FROM table
won't work because of the asterisk - instead try:

Code: Select all

DELETE FROM tempkomponen
http://www.mysql.com/doc/en/DELETE.html

Mac
User avatar
apek
Forum Commoner
Posts: 96
Joined: Tue Jan 06, 2004 11:19 pm
Location: Holiday Plaza Johor Bahru

............

Post by apek »

geee..it works..
thanx a bunch!!!
Post Reply