You are here: Re: Passing variables out of a function « PHP Programming Language « IT news, forums, messages
Re: Passing variables out of a function

Posted by ZeldorBlat on 05/18/07 15:12

On May 18, 10:47 am, Akhenaten <jonko...@gmail.com> wrote:
> On May 18, 9:18 am, Akhenaten <jonko...@gmail.com> wrote:
>
>
>
> > For whatever reason I can't get my return value to pass outside of the
> > function I've created. I've tested all the responses within the
> > function so I know the data is there and the sql query is valid. Am I
> > missing something to get it passed outside the function?
>
> > ******************************
>
> > function respond_check($qid,$username)
> > {
> > include "db.inc.php";
> > $postchk2 = mysql_query("SELECT username FROM `answers` , `users`
> > WHERE `qid` = $qid AND `a_uid` = `userid` LIMIT 0, 30",$db);
> > while ($userx=mysql_fetch_array($postchk2))
> > {
> > if (in_array($username,$userx)) {
> > $freturn = 7;
> > return $freturn;
>
> > }
> > }
> > }
>
> > ******************************
>
> Disregard -- it's always the simple mistakes that make you pound your
> head. I failed to make $freturn global.

The whole point of returning it from the function is so you don't have
to make it a global.

 

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

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