Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002

    Unanswered: Search and replace an SQL file


    I need to perform a search and replace on a SQL file with rows as follows:

    INSERT INTO productos VALUES("10272","El criticón","306","89,55","85,07","80,6","71,64","", "","","","","","");

    I need to be able to replace the commas in the prices (89,55 85,07 80,06 & 71,64) as this is causing errors in how the prices are displayed.

    Obviously I can't do a standard search and replace because of the commas between Db fields. Can anyone suggest any pointers as to how I might go about this with PHP?

    Even before search / replace issues can PHP read an external file?

    Thanks in advance for all advice,


  2. #2
    Join Date
    Feb 2002
    Baltimore, MD
    You can use regular expressions in conjunctions with the eregi_replace() function. Something like this may work for you ( or at least set you on the right track ).

    $pattern = '\"[^,]*,[^"]*\"';	
    eregi_replace ( $pattern, '.', $string )
    Rob Wilkerson

Posting Permissions

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