Re: delete syntax

2011-12-02 Thread Claudio Nanni
2011/12/2 Reindl Harald h.rei...@thelounge.net

 well, i am using delete/insert-statements since 10 years to maintain
 users since you only have to know the tables in the database mysql
 and use flush privileges after changes

 The privileges should be maintained  only using the designated commands.
You cannot rely on the knowledge you have of the underlying implementation
which can change anytime , while the privileges command are standard.

*Cheers*

Claudio Nanni


 DROP USER is the only SINGLE COMMAND

 as long as you do not use table/column-privileges there are exactly
 two relevant tables: user and db

 Am 02.12.2011 05:15, schrieb Stdranwl:
  DROP USER command is the only command to remove any user and its
  association from all other tables.
 
  On Fri, Dec 2, 2011 at 8:22 AM, Reindl Harald h.rei...@thelounge.net
 wrote:
 
  ALWAYS
  start with select * from mysql.user where user='mail_admin' and host
 like
  '\%';
  and look what records are affected to make sure the were-statement
 works as
  expected and then use CURSOR UP and edit the last command to delete
  from
 
  not only doing this while unsure with escapes  protects you against
 logical
  mistakes like forget a and column=1 and get 1000 rows affected with
 no
  way back




-- 
Claudio


Re: delete syntax

2011-12-02 Thread Reindl Harald


Am 02.12.2011 21:59, schrieb Claudio Nanni:
 2011/12/2 Reindl Harald h.rei...@thelounge.net
 
 well, i am using delete/insert-statements since 10 years to maintain
 users since you only have to know the tables in the database mysql
 and use flush privileges after changes

 The privileges should be maintained  only using the designated commands.
 You cannot rely on the knowledge you have of the underlying implementation
 which can change anytime , while the privileges command are standard.

do what you think is good for you if YOU can't be sure what you do
there where i work i test updates and look at the user-tables
and that is why i fixed problems where root did not have the
right permissions after upgrade to 5.1 what was not corrected
with mysql_upgrade an rolled out without any problems

the same way i currently roll out fedora 15 on 24 production
servers because i know what i do and have the infrastructure
to prepare such major-upgrades to do them finally live after
all tests are successfull and the local cach- and internal-repos
are filled

so please do not tell other peopole on what knowledge they can rely



signature.asc
Description: OpenPGP digital signature


Re: delete syntax

2011-12-02 Thread Govinda
 
 well, i am using delete/insert-statements since 10 years to maintain
 users since you only have to know the tables in the database mysql
 and use flush privileges after changes
 
 The privileges should be maintained  only using the designated commands.
 You cannot rely on the knowledge you have of the underlying implementation
 which can change anytime , while the privileges command are standard.
 
 do what you think is good for you if YOU can't be sure what you do
 [snip]
 so please do not tell other peopole on what knowledge they can rely
 


*all* the back and forth in these threads is good.. is susses out all the 
knowledge for everyone to see.
Sincerely thanks to everyone who chimes in from all perspectives,
-Govinda
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



delete syntax

2011-12-01 Thread Tim Dunphy
hello list,

 I am attempting to delete a user from the mysql.user table  without success.

  mysql delete from mysql.user where user='mail_admin@%';
Query OK, 0 rows affected (0.00 sec)
 

 mysql select user,host from mysql.user where user='mail_admin';
++---+
| user   | host  |
++---+
| mail_admin | % |



 I would appreciate any advice you may have.

 Regards,
Tim

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: delete syntax

2011-12-01 Thread Krishna Chandra Prajapati
delete from mysql.user where user='mail_admin';

Krishna

On Fri, Dec 2, 2011 at 7:23 AM, Tim Dunphy bluethu...@jokefire.com wrote:

 hello list,

  I am attempting to delete a user from the mysql.user table  without
 success.

  mysql delete from mysql.user where user='mail_admin@%';
 Query OK, 0 rows affected (0.00 sec)


  mysql select user,host from mysql.user where user='mail_admin';
 ++---+
 | user   | host  |
 ++---+
 | mail_admin | % |



  I would appreciate any advice you may have.

  Regards,
 Tim

 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql




Re: delete syntax

2011-12-01 Thread Tim Dunphy
Hello Krishna,
 
 
Thanks but I probably should have noted that I only want to delete the wildcard 
user. There are other users I would prefer to not delete.

mysql select user,host from mysql.user where user='mail_admin';
++---+
| user   | host  |
++---+
| mail_admin | % |
| mail_admin | 127.0.0.1 |
| mail_admin | localhost |
| mail_admin | localhost.localdomain |
++---+
4 rows in set (0.00 sec)


sorry for not including enough information last time.

best
tim

- Original Message -
From: Krishna Chandra Prajapati prajapat...@gmail.com
To: Tim Dunphy bluethu...@jokefire.com
Cc: mysql@lists.mysql.com
Sent: Thursday, December 1, 2011 9:03:46 PM
Subject: Re: delete syntax

delete from mysql.user where user='mail_admin'; 

Krishna 


On Fri, Dec 2, 2011 at 7:23 AM, Tim Dunphy  bluethu...@jokefire.com  wrote: 


hello list, 

I am attempting to delete a user from the mysql.user table without success. 

mysql delete from mysql.user where user='mail_admin@%'; 
Query OK, 0 rows affected (0.00 sec) 


mysql select user,host from mysql.user where user='mail_admin'; 
++---+ 
| user | host | 
++---+ 
| mail_admin | % | 



I would appreciate any advice you may have. 

Regards, 
Tim 

-- 
MySQL General Mailing List 
For list archives: http://lists.mysql.com/mysql 
To unsubscribe: http://lists.mysql.com/mysql 



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: delete syntax

2011-12-01 Thread Keith Keller
On 2011-12-02, Tim Dunphy bluethu...@jokefire.com wrote:
  
 Thanks but I probably should have noted that I only want to delete the 
 wildcard user. There are other users I would prefer to not delete.

 mysql select user,host from mysql.user where user='mail_admin';
 ++---+
| user   | host  |
 ++---+
| mail_admin | % |
| mail_admin | 127.0.0.1 |
| mail_admin | localhost |
| mail_admin | localhost.localdomain |
 ++---+
 4 rows in set (0.00 sec)

This is just a regular table with a user and host column.  If you wanted
to delete the localhost row, you'd do

delete from mysql.user where user='mail_admin' and host='localhost';
flush privileges;

You'd need to flush privileges because you're munging the user table.
But it's probably much better to use the DROP USER command.

--keith


-- 
kkeller-use...@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: delete syntax

2011-12-01 Thread Shiva
You can try

delete from mysql.user
where user='mail_admin'
   and host like '\%' ;

Note: I haven't tested it and since % is a wildcard you need to escape it.
Best,
Shiv

On Thu, Dec 1, 2011 at 6:09 PM, Tim Dunphy bluethu...@jokefire.com wrote:

 Hello Krishna,


 Thanks but I probably should have noted that I only want to delete the
 wildcard user. There are other users I would prefer to not delete.

 mysql select user,host from mysql.user where user='mail_admin';
 ++---+
 | user   | host  |
 ++---+
 | mail_admin | % |
 | mail_admin | 127.0.0.1 |
 | mail_admin | localhost |
 | mail_admin | localhost.localdomain |
 ++---+
 4 rows in set (0.00 sec)


 sorry for not including enough information last time.

 best
 tim

 - Original Message -
 From: Krishna Chandra Prajapati prajapat...@gmail.com
 To: Tim Dunphy bluethu...@jokefire.com
 Cc: mysql@lists.mysql.com
 Sent: Thursday, December 1, 2011 9:03:46 PM
 Subject: Re: delete syntax

 delete from mysql.user where user='mail_admin';

 Krishna


 On Fri, Dec 2, 2011 at 7:23 AM, Tim Dunphy  bluethu...@jokefire.com 
 wrote:


 hello list,

 I am attempting to delete a user from the mysql.user table without success.

 mysql delete from mysql.user where user='mail_admin@%';
 Query OK, 0 rows affected (0.00 sec)


 mysql select user,host from mysql.user where user='mail_admin';
 ++---+
 | user | host |
 ++---+
 | mail_admin | % |



 I would appreciate any advice you may have.

 Regards,
 Tim

 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe: http://lists.mysql.com/mysql



 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql




Re: delete syntax

2011-12-01 Thread Reindl Harald
ALWAYS
start with select * from mysql.user where user='mail_admin' and host like 
'\%';
and look what records are affected to make sure the were-statement works as
expected and then use CURSOR UP and edit the last command to delete from

not only doing this while unsure with escapes  protects you against logical
mistakes like forget a and column=1 and get 1000 rows affected with no
way back

Am 02.12.2011 03:43, schrieb Shiva:
 delete from mysql.user where user='mail_admin' and host like '\%' ;
 Note: I haven't tested it and since % is a wildcard you need to escape it.
 
 On Thu, Dec 1, 2011 at 6:09 PM, Tim Dunphy bluethu...@jokefire.com wrote:
 

 Thanks but I probably should have noted that I only want to delete the
 wildcard user. There are other users I would prefer to not delete.

 mysql select user,host from mysql.user where user='mail_admin';
 ++---+
 | user   | host  |
 ++---+
 | mail_admin | % |
 | mail_admin | 127.0.0.1 |
 | mail_admin | localhost |
 | mail_admin | localhost.localdomain |
 ++---+
 4 rows in set (0.00 sec)



signature.asc
Description: OpenPGP digital signature


Re: delete syntax

2011-12-01 Thread Stdranwl
DROP USER command is the only command to remove any user and its
association from all other tables.

Cheers

On Fri, Dec 2, 2011 at 8:22 AM, Reindl Harald h.rei...@thelounge.netwrote:

 ALWAYS
 start with select * from mysql.user where user='mail_admin' and host like
 '\%';
 and look what records are affected to make sure the were-statement works as
 expected and then use CURSOR UP and edit the last command to delete
 from

 not only doing this while unsure with escapes  protects you against logical
 mistakes like forget a and column=1 and get 1000 rows affected with no
 way back

 Am 02.12.2011 03:43, schrieb Shiva:
  delete from mysql.user where user='mail_admin' and host like '\%' ;
  Note: I haven't tested it and since % is a wildcard you need to escape
 it.
 
  On Thu, Dec 1, 2011 at 6:09 PM, Tim Dunphy bluethu...@jokefire.com
 wrote:
 
 
  Thanks but I probably should have noted that I only want to delete the
  wildcard user. There are other users I would prefer to not delete.
 
  mysql select user,host from mysql.user where user='mail_admin';
  ++---+
  | user   | host  |
  ++---+
  | mail_admin | % |
  | mail_admin | 127.0.0.1 |
  | mail_admin | localhost |
  | mail_admin | localhost.localdomain |
  ++---+
  4 rows in set (0.00 sec)




Re: delete syntax

2011-12-01 Thread Reindl Harald
well, i am using delete/insert-statements since 10 years to maintain
users since you only have to know the tables in the database mysql
and use flush privileges after changes

DROP USER is the only SINGLE COMMAND

as long as you do not use table/column-privileges there are exactly
two relevant tables: user and db

Am 02.12.2011 05:15, schrieb Stdranwl:
 DROP USER command is the only command to remove any user and its
 association from all other tables.
 
 On Fri, Dec 2, 2011 at 8:22 AM, Reindl Harald h.rei...@thelounge.netwrote:
 
 ALWAYS
 start with select * from mysql.user where user='mail_admin' and host like
 '\%';
 and look what records are affected to make sure the were-statement works as
 expected and then use CURSOR UP and edit the last command to delete
 from

 not only doing this while unsure with escapes  protects you against logical
 mistakes like forget a and column=1 and get 1000 rows affected with no
 way back



signature.asc
Description: OpenPGP digital signature


DELETE syntax

2005-10-10 Thread mark
Hi,

 

I need to know the syntax I can use for a certain delete statement. This is
the idea:

- A table with users, which has at least these fields, a user id field and a
field containing its status (active, disabled, review).
- A table that links certain users to each other, containing at least these
fields: a link id, a user id 1 and a user id 2.

Now I want to delete all records from the second table when any of the
linked users is disabled, eg something like this:

DELETE FROM `matches` WHERE `userAid` IN ('SELECT `ID` FROM `users` WHERE
`status`='disabled')' OR `userBid` IN ('SELECT `ID` FROM `users` WHERE
`status`='disabled')'



The query must be run on a mysql server version 4.0.24

 

Thanks for any help with this one,

Mark



Re: DELETE syntax

2005-10-10 Thread Remo Tex

http://dev.mysql.com/doc/mysql/en/delete.html
...
 Multiple-table syntax:

DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
   tbl_name[.*] [, tbl_name[.*] ...]
   FROM table_references
   [WHERE where_definition]

Or:

DELETE [LOW_PRIORITY] [QUICK] [IGNORE]
   FROM tbl_name[.*] [, tbl_name[.*] ...]
   USING table_references
   [WHERE where_definition]
...
 From MySQL 4.0, you can specify multiple tables in the DELETE 
statement to delete rows from one or more tables depending on a 
particular condition in multiple tables. However, you cannot use ORDER 
BY or LIMIT in a multiple-table DELETE.


The first multiple-table DELETE syntax is supported starting from MySQL 
4.0.0. The second is supported starting from MySQL 4.0.2. The 
table_references part lists the tables involved in the join. Its syntax 
is described in Section 13.2.7.1, “JOIN Syntax”.


That's fo MyISAM and.. for InnoDB read Rhino's answer to  Merlin's 
thread (just above) deleting rows in 2 tables about Foreign key(s) and 
 on delete cascade


[EMAIL PROTECTED] wrote:

Hi,

 


I need to know the syntax I can use for a certain delete statement. This is
the idea:

- A table with users, which has at least these fields, a user id field and a
field containing its status (active, disabled, review).
- A table that links certain users to each other, containing at least these
fields: a link id, a user id 1 and a user id 2.

Now I want to delete all records from the second table when any of the
linked users is disabled, eg something like this:

DELETE FROM `matches` WHERE `userAid` IN ('SELECT `ID` FROM `users` WHERE
`status`='disabled')' OR `userBid` IN ('SELECT `ID` FROM `users` WHERE
`status`='disabled')'



The query must be run on a mysql server version 4.0.24

 


Thanks for any help with this one,

Mark




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



multiple table delete syntax question

2004-07-25 Thread doug
I have a question about the multiple table delete syntax. First the
documentation on the website is very clear. My question is why not how. The
'delete from using' is not ambiguous (to me). My question is about the form:

   delete t1 from t1,t2 where ...

I would take this to mean remove matching records from t2. I assume the reason
records are removed from t1 is SQL language consistency.  But as an SQL newbie,
I can not see it.

Thanks for any thoughts.

_
Douglas Denault
http://www.safeport.com
[EMAIL PROTECTED]
Voice: 301-469-8766
  Fax: 301-469-0601

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: multiple table delete syntax question

2004-07-25 Thread Michael Stassen
[EMAIL PROTECTED] wrote:
I have a question about the multiple table delete syntax. First the
documentation on the website is very clear. My question is why not how. The
'delete from using' is not ambiguous (to me). My question is about the form:
   delete t1 from t1,t2 where ...
I would take this to mean remove matching records from t2. I assume the reason
records are removed from t1 is SQL language consistency.  But as an SQL newbie,
I can not see it.
Thanks for any thoughts.
_
Douglas Denault
The point is to distinguish between the tables which are joined to pick the 
rows and the tables from which rows are to be deleted.  You have 2 options:

  DELETE FROM t1 USING t1,t2 ...
or
  DELETE t1 FROM t1,t2 ...
Perhaps you are extrapolating from 'DELETE FROM t1...' to expect that the 
second form should delete from both tables, but note that the second form is 
not 'DELETE FROM t1,t2...', it's 'DELETE t1 FROM t1,t2...'.  If you must 
relate it to something, I'd suggest 'SELECT t1.* FROM t1,t2 ...' is the 
natural parallel.

Michael
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: multiple table delete syntax question

2004-07-25 Thread doug
I have no problem understanding the syntax, or how to do what I want (at least
after my first mistake). It is more about if this is a consistant grammar. For
example, unix commands have the form verb src object, except for ln -s
(IMO).

From a lexical view, I do not think the two forms are parallel. My question was,
is this to be consistant with other sql constructs, or is it just the way it is?

On Sun, 25 Jul 2004, Michael Stassen wrote:

 The point is to distinguish between the tables which are joined to pick the
 rows and the tables from which rows are to be deleted.  You have 2 options:

DELETE FROM t1 USING t1,t2 ...

 or

DELETE t1 FROM t1,t2 ...

 Perhaps you are extrapolating from 'DELETE FROM t1...' to expect that the
 second form should delete from both tables, but note that the second form is
 not 'DELETE FROM t1,t2...', it's 'DELETE t1 FROM t1,t2...'.  If you must
 relate it to something, I'd suggest 'SELECT t1.* FROM t1,t2 ...' is the
 natural parallel.

 Michael


_
Douglas Denault
http://www.safeport.com
[EMAIL PROTECTED]
Voice: 301-469-8766
  Fax: 301-469-0601

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



DELETE SYNTAX - [QUICK] option

2003-06-26 Thread Nils Valentin
Hi MySQL Fans ;-);

Does anybody understand what the QUICK option is doing when used with the 
DELETE command ? It says in the manual ..no MERGEing of INDEX leaves during 
delete.

Sorry, but I could not make any sense out of this. Could somebody please be so 
kind to enlighten me ?

I guess it is related somehow to optimizing the index or space of a table.

Best regards
-- 
---
Valentin Nils
Internet Technology

 E-Mail: [EMAIL PROTECTED]
 URL: http://www.knowd.co.jp
 Personal URL: http://www.knowd.co.jp/staff/nils


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: DELETE SYNTAX - [QUICK] option

2003-06-26 Thread Paul DuBois
At 16:22 +0900 6/26/03, Nils Valentin wrote:
Hi MySQL Fans ;-);

Does anybody understand what the QUICK option is doing when used with the
DELETE command ? It says in the manual ..no MERGEing of INDEX leaves during
delete.
Sorry, but I could not make any sense out of this. Could somebody please be so
kind to enlighten me ?
I guess it is related somehow to optimizing the index or space of a table.
It may make the query quicker because the server doesn't do as much
messing around fixing up the leaves of the index tree.
Best regards
--
---
Valentin Nils
Internet Technology
 E-Mail: [EMAIL PROTECTED]
 URL: http://www.knowd.co.jp
 Personal URL: http://www.knowd.co.jp/staff/nils


--
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
Are you MySQL certified?  http://www.mysql.com/certification/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


'delete' syntax

2003-03-31 Thread warm-fusion
Hi, I'm just wondering what the right syntax for using the delete 
statement is? I'm trying to write a simple garbage collection/deletion 
query similar to the queries below.

delete from 'item' where 'quantity_of_item_in_stock' = 10;

(the above version of the query pops up a Java-applet alert asking if I 
really want to xyz, then it gives an error in MyPHPAdmin)

delete * from 'item' where 'quantity_of_item_in_stock' = 10;

(this one just gives an error in MyPHPAdmin)

Thanks again!

Marc

On two occasions I have been asked [by members of Parliament!], 'Pray, 
Mr. Babbage, if you put into the machine wrong figures, will the right 
answers come out?' I am not able rightly to apprehend the kind of 
confusion of ideas that could provoke such a question.
	~Charles Babbage


Re: 'delete' syntax

2003-03-31 Thread gerald_clark


warm-fusion wrote:

Hi, I'm just wondering what the right syntax for using the delete 
statement is? I'm trying to write a simple garbage collection/deletion 
query similar to the queries below.

delete from 'item' where 'quantity_of_item_in_stock' = 10; 
delete from item where quantity_of_item_in_stock =10;



(the above version of the query pops up a Java-applet alert asking if 
I really want to xyz, then it gives an error in MyPHPAdmin)

delete * from 'item' where 'quantity_of_item_in_stock' = 10;

(this one just gives an error in MyPHPAdmin)

Thanks again!

Marc

On two occasions I have been asked [by members of Parliament!], 
'Pray, Mr. Babbage, if you put into the machine wrong figures, will 
the right answers come out?' I am not able rightly to apprehend the 
kind of confusion of ideas that could provoke such a question.
~Charles Babbage



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: 'delete' syntax

2003-03-31 Thread Fred van Engen
Hi,

On Mon, Mar 31, 2003 at 03:40:03PM +0100, warm-fusion wrote:
 Hi, I'm just wondering what the right syntax for using the delete 
 statement is? I'm trying to write a simple garbage collection/deletion 
 query similar to the queries below.
 
 delete from 'item' where 'quantity_of_item_in_stock' = 10;
 

Why do you use quotes around table and field names? If you want to, then
use backquotes (`) i.s.o. quotes (') or double quotes (). The latter
are used for strings.


 (the above version of the query pops up a Java-applet alert asking if I 
 really want to xyz, then it gives an error in MyPHPAdmin)
 
 delete * from 'item' where 'quantity_of_item_in_stock' = 10;
 

Yes, this is incorrect syntax.


Regards,

Fred.

-- 
Fred van Engen  XB Networks B.V.
email: [EMAIL PROTECTED]Televisieweg 2
tel: +31 36 5462400 1322 AC  Almere
fax: +31 36 5462424 The Netherlands

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



re: Delete syntax

2002-09-17 Thread Victoria Reznichenko

smudholkar,
Tuesday, September 17, 2002, 12:26:05 AM, you wrote:

saadc I am trying to write a delete query that will remove 
saadc records from one table based on information from 
saadc another table. In this example, there is a table called 
saadc accounting which contains two fields: username and 
saadc sessiontime and another table called users with two 
saadc fields: username and password. I would like records to 
saadc be deleted from the users table if the session time in 
saadc the accounting table exceeds a certain value, say 1000. 
saadc I have written the following statement:

saadc delete from users where accounting.username = 
saadc users.username and accounting.sessiontime  1000;

saadc The statement fails to execute  with the following 
saadc error: “Unknown table ‘accounting’ in where clause” and 
saadc I can’t figure out why. Your help is greatly 
saadc appreciated, thanks in advance!

Because you don't specify table 'accounting' in the FROM clause. take
a look at correct syntax for multi-table delete:
http://www.mysql.com/doc/en/DELETE.html


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   ___/   www.mysql.com





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




DELETE syntax and auto_increment 'reset'

2002-05-22 Thread Jule

Hey guys,
when i delete a row using the query DELETE FROM $table WHERE id = 3 LIMIT 1;

how can i make it that the id column (auto_increment) starts over from 1 and
build up to however many rows there are without counting 1 2 4 5 6 etc.?

any ideas?

Jule
--

|\/\__/\/|
|   Jule Slootbeek   |
|   [EMAIL PROTECTED]|
|   http://blindtheory.cjb.net   |
|   __   |
|/\/  \/\|

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: DELETE syntax and auto_increment 'reset'

2002-05-22 Thread Paul DuBois

At 18:29 -0400 5/22/02, Jule wrote:
Hey guys,
when i delete a row using the query DELETE FROM $table WHERE id = 3 LIMIT 1;

how can i make it that the id column (auto_increment) starts over from 1 and
build up to however many rows there are without counting 1 2 4 5 6 etc.?

If you're asking how to fill in holes created by deleting rows from the
middle of the sequence, you can't.

Why would you want to?

If you're really determined to do this, you can renumber the entire
column so that the rows are sequential beginning with one.


any ideas?

Jule
--

|\/\__/\/|
|   Jule Slootbeek  |
|   [EMAIL PROTECTED]   |
|   http://blindtheory.cjb.net  |
|   __  |
|/\/ \/\|


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




delete syntax - forms processing problem

2002-02-28 Thread A. Caldwell

Hi there,

I've been struggling with this  the mysql
documentation doesn't seem to be helping much.  I'll
try to make this as short as possible...

I have a phone directory that allows a user to search
the database by name  the results.php page has two
forms in it.  one form allows the user to modify the
entry  submit changes to the database - this works
fine.  the other form allows the user to delete the
entry (row) from the database - not working.

This is basically my code for the results.php page:

while ($row = mysql_fetch_array($result))
 {
 $searchterm = $realname;
 echo table;
 echo form name=modify method=post
action=\save_changes.php\;
 echo trtdbfont face=arial
size=2Name/font/b/td;
 echo tdinput type=text size=25 name=realname
value=\$row[realname]\/td/tr;
 echo trtdbfont face=arial size=2Office
Phone/font/b/td;
 echo tdinput type=text size=25 name=phone
value=\$row[phone]\/td/tr/form;
 echo form name=remove method=post
action=\remove_entry.php\;
 echo tdinput type=submit name=remove
value=\Remove Entry\/td;
 echo /form/tr/table;
 
This is the code for the remove_entry.php page:

$result = mysql_query(DELETE FROM directory WHERE
realname='$realname')) or die (mysql_error()); 


- I'm not receiving an error, but it is going to the
end  showing 'removal successful!' but the row is not
deleted from the database.  Can someone tell me where
I'm going wrong?

Thank you in advance!
Andrea

__
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: delete syntax - forms processing problem

2002-02-28 Thread DL Neil

Hi Andrea,

 I have a phone directory that allows a user to search
 the database by name  the results.php page has two
 forms in it.  one form allows the user to modify the
 entry  submit changes to the database - this works
 fine.  the other form allows the user to delete the
 entry (row) from the database - not working.
...
 This is the code for the remove_entry.php page:

 $result = mysql_query(DELETE FROM directory WHERE
 realname='$realname')) or die (mysql_error());

 - I'm not receiving an error, but it is going to the
 end  showing 'removal successful!' but the row is not
 deleted from the database.  Can someone tell me where
 I'm going wrong?


Is the value in $realname debug ECHOed prior to the query call?
Is there a check on the number of rows affected by the DELETE, after the call?
Why not post the code from the query preparation through to the 'removal succesful' 
msg - which must be
something you've written and is possibly where the/another problem lies?

Regards,
=dn

PS (so the purists don't shoot you down: you do know there's a separate PHP list and a 
PHP-DB specific list,
don't you?


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php