UPDATE statment

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
mudge.steve
Forum Newbie
Posts: 10
Joined: Thu Apr 22, 2010 3:28 pm

UPDATE statment

Post by mudge.steve »

I am trying to update a new field with a field named 'filename' but only want the left charactors (length of what it is -4)

I am a newbi! Please help

UPDATE photographs SET basefilename = substr(filename,0,lengh(filename)-4)
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: UPDATE statment

Post by mikosiko »

seems to me that you are trying to get just the filename without extension right?... if so... look here
http://php.net/manual/en/function.basename.php

and scroll down to the second example
Post Reply