Jump to content

TRIM leading " from varchar field


Donovan

Recommended Posts

Somebody offered up this code to help me trim a " from a Last_Name field.  It is not working.

 

$stripname = $db->sql_query("UPDATE ".$prefix."$table_name SET Name_Last = TRIM(LEADING '\"' FROM 'Name_Last'");

 

I also tried a ltrim but could not get that working either.

 

The field looks like this.

 

"ABRAHAM

"BAXTER

"COOPER

 

The Name_First looks like this

COREY  "

ROBYN A"

NICHOL W"

 

Yes you can imagine what the field looked like from the csv file

"COOPER, ROBYN A"

 

I split it on the comma during the import

 

FIELDS TERMINATED BY ','

 

But now I can't get the " stripped off the name fields.

 

Any help is appreciated.

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/81717-trim-leading-from-varchar-field/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.