Reply to Re: function in mysql query

Your name:

Reply:


Posted by Jerry Stuckle on 11/07/07 13:16

steeve_dun@SoftHome.net wrote:
> Hi,
> What I want is to check for empty values for field 2 and put a result
> a function instead.
> eg :
>
> function func1($val){
> return $val.'bis';
> }
>
> $query = "UPDATE vals SET val2 = '".func1(`val1`)."' WHERE `val2` IS
> NULL";
>
> but the problem is that I can't recover val1 in func1
>
> So, is there a way to do so?
> Thanks
>
>

Nope, you can't retrieve the value in an update statement. You'll need
to SELECT the row then process it.

Or check a SQL newsgroup for a way to do it in SQL.

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация