php/mysql replace

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Master_Di

    php/mysql replace

    Hy
    First sorry for my terreble english.
    How do i remove first 3 words in field "post". I nead to remove first 3
    words i all the records.
    In every new record legnth of the words are different.

    My table structure looks like this
    `ID` bigint(21) NOT NULL auto_increment,
    `title` varchar(60) NOT NULL default '',
    `author` bigint(20) NOT NULL default '0',
    `telapsed` bigint(21) NOT NULL default '0',
    `timepost` varchar(100) NOT NULL default '',
    `numreplies` int(10) NOT NULL default '0',
    `post` longtext NOT NULL,
    `threadparent` bigint(21) NOT NULL default '0',
    `lastpost` varchar(255) NOT NULL default '',
    `postforum` bigint(20) NOT NULL default '0',
    `views` bigint(20) NOT NULL default '0',
    `nosmilies` int(11) NOT NULL default '0',
    `value` int(11) NOT NULL default '0',
    `ipaddress` varchar(255) NOT NULL default '',
    `locked` int(11) NOT NULL default '0',
    `zupanija` varchar(100) NOT NULL default '',
    `opcina` varchar(100) NOT NULL default '',
    `kategorija` varchar(100) NOT NULL default '',
    PRIMARY KEY (`ID`)


    sample record:

    '1', 'This', '5', '1064850845', '2007/05/20 15:26:19', '0',
    'word1 word2 word3 This is test message', '0', '', '1', '1', '1',
    '0', '1234566', '0', '051', 'Rogla', 'Kat1'


    Tnx in advance on your time
    Dejan



  • Jerry Stuckle

    #2
    Re: php/mysql replace

    Master_Di wrote:
    Hy
    First sorry for my terreble english.
    How do i remove first 3 words in field "post". I nead to remove first 3
    words i all the records.
    In every new record legnth of the words are different.
    >
    My table structure looks like this
    `ID` bigint(21) NOT NULL auto_increment,
    `title` varchar(60) NOT NULL default '',
    `author` bigint(20) NOT NULL default '0',
    `telapsed` bigint(21) NOT NULL default '0',
    `timepost` varchar(100) NOT NULL default '',
    `numreplies` int(10) NOT NULL default '0',
    `post` longtext NOT NULL,
    `threadparent` bigint(21) NOT NULL default '0',
    `lastpost` varchar(255) NOT NULL default '',
    `postforum` bigint(20) NOT NULL default '0',
    `views` bigint(20) NOT NULL default '0',
    `nosmilies` int(11) NOT NULL default '0',
    `value` int(11) NOT NULL default '0',
    `ipaddress` varchar(255) NOT NULL default '',
    `locked` int(11) NOT NULL default '0',
    `zupanija` varchar(100) NOT NULL default '',
    `opcina` varchar(100) NOT NULL default '',
    `kategorija` varchar(100) NOT NULL default '',
    PRIMARY KEY (`ID`)
    >
    >
    sample record:
    >
    '1', 'This', '5', '1064850845', '2007/05/20 15:26:19', '0',
    'word1 word2 word3 This is test message', '0', '', '1', '1', '1',
    '0', '1234566', '0', '051', 'Rogla', 'Kat1'
    >
    >
    Tnx in advance on your time
    Dejan
    >
    >
    >
    You should ask in comp.databases. mysql. You probably can find a SQL
    solution for it.

    Otherwise, read each row in, delete the first three words with any of a
    number of PHP functions and update the row.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    Working...