You are here: Re: function in mysql query « PHP Programming Language « IT news, forums, messages
Re: function in mysql query

Posted by Darko on 11/07/07 19:58

On Nov 7, 2:03 pm, steeve_...@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

What do you mean by "can't *recover* vall *in funcl*"?
The first thing that I notice is you use those weirh ` simbols instead
of ' or "". And furhter, "WHERE `val2` IS NULL" also confuses me, why
do you need ` around val2?

$query = "UPDATE vals SET val2 = '" . func1("val1") . "' WHERE val2 IS
NULL";

Maybe I'm missing the point?

Darko

 

Navigation:

[Reply to this 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

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