Hello,

I ve got mysql 4.0.1
I don't understand what happen.
I use to make replace other than insert in order to avoid error in php
scripts.

I have a table with on primary key :

CREATE TABLE `nlconfig` (
  `id` tinyint(4) NOT NULL auto_increment,
  `nomnews` varchar(255) NOT NULL default '',
  `hebergeur` varchar(255) NOT NULL default '',
  `fromc` varchar(255) NOT NULL default '[EMAIL PROTECTED]',
  `fromonline` varchar(255) NOT NULL default 'contact',
  `limitconf` tinyint(2) NOT NULL default '7',
  `host` varchar(255) NOT NULL default 'localhost',
  `user` varchar(255) NOT NULL default 'root',
  `passwd` varchar(255) NOT NULL default '',
  `db` varchar(255) NOT NULL default 'newsfr',
  `tablenews` varchar(255) NOT NULL default 'news',
  `tabletemp` varchar(255) NOT NULL default 'temp',
  `tablelog` varchar(255) NOT NULL default 'log',
  `tableconfig` varchar(255) NOT NULL default 'nlconfig',
  `admin_pass` varchar(255) NOT NULL default 'pikatchu',
  `limitlog` tinyint(2) NOT NULL default '10',
  `url` varchar(255) NOT NULL default '',
  `pathtopmn` varchar(255) NOT NULL default 'http://www.test.fr/fr/',
  `langfile` varchar(255) NOT NULL default 'lang-french.php',
  `welcome_subj` varchar(255) NOT NULL default 'bienvenue',
  `welcome_msg` text NOT NULL,
  `sub_msg` text NOT NULL,
  `pied` tinytext NOT NULL,
  `validation` tinyint(1) NOT NULL default '1',
  `description` text,
  `newstemplate` varchar(100) default NULL,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;


When inserting with mysqlfront windows client :

replace into nlconfig values (last_insert_id(),'abc', 'nexen', 'a@', 'a',
'', 'localhost', 'root' , '', 'newsfr', 'news', 'temp', 'log', 'nlconfig',
'lucas', '', '', 'http://www.test.fr/fr/', 'lang-french.php', '','','','',
'1','','' );

1st on row affected
2nd 2rows.

I get no error.
But from a php 4.06 script I get :
errno 1062: erromsg : Duplicata du champ '127' pour la clef 1
That means : duplicate value for key 1.

That the same error i get with NULL in id with the windows client ?!

Could you explain me what happen.

I only want to insert a new row when values are different from what is on
the table,
and to replace the row that there is when there is the same id or when all
the data in query is the same !
Is it for that, that replace is for ?


Thanks.



___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.comm

---------------------------------------------------------------------
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

Reply via email to