Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004

    Replace MySQL data

    I have a MySQL table that has about 105,000 records.

    PHP Code:
    CREATE TABLE IF NOT EXISTS `tbl_message_log` (
    pk_record_idint(11NOT NULL AUTO_INCREMENT,
    fk_user_idint(11) DEFAULT NULL,
    messagevarchar(640) DEFAULT NULL,
    message_recipientvarchar(25) DEFAULT NULL,
    PRIMARY KEY (`pk_record_id`) 
    I want to replace all the records of the column "message" with a customer text 'This is a test mess'+the 'fk_user_id' in this case the 100th record will be filled with a text "This is a test mess 100"

    How can I do it using SQL commands in PHPmyadmin?

  2. #2
    Join Date
    Apr 2011
    If there is nothing already in the field for all record set you could delete that column then re instate it and set the default to the required text message.

    Or just run an sql statement to update that column and run it through an incrementing loop.

  3. #3
    Join Date
    Feb 2011
    update tbl_message_log set message = replace(message,message,CONCAT('This is a test mess ',fk_user_id));

Similar Threads

  1. How to replace part of a string in MySQL?
    By jsp_1983 in forum Programming Discussion
    Replies: 7
    Last Post: 12-19-2013, 07:26 AM
  2. mysql replace drives and folders
    By ti_nhatrang in forum Programming Discussion
    Replies: 8
    Last Post: 07-08-2012, 05:08 PM
  3. How to replace data in MySQL field
    By golfer in forum Programming Discussion
    Replies: 7
    Last Post: 12-14-2011, 05:25 AM
  4. PHP/MySQL Query, replace output?
    By RW-Steven in forum Programming Discussion
    Replies: 2
    Last Post: 04-28-2009, 02:44 AM
  5. REPLACE command in mySQL?
    By Franki in forum Hosting Security and Technology
    Replies: 8
    Last Post: 05-12-2002, 08:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts