You are here: Re: Select function problem « PHP « IT news, forums, messages
Re: Select function problem

Posted by R. Ros on 10/04/33 11:07

include this on top of your function:

global $dbLink;

Hugo Westermann Castanho schreef:
> When i run this function , i get this error
> Warning: mysql_query(): supplied argument is not a valid MySQL-Link
> resource in e:\webserver\virtualnovo\test.php on line 8
> Warning: mysql_result(): supplied argument is not a valid MySQL result
> resource in e:\webserver\virtualnovo\test.php on line 9
>
>
> <?PHP
> $dbLink = mysql_connect( "host", "login", "password" ) or
> trigger_error (mysql_error (), E_USER_ERROR );
> $dataBase = "database";
> mysql_select_db ($dataBase, $dbLink);
>
> function fctSelect() {
> $varSQL = "select * from persons";
> $varQuery = mysql_query($varSQL, $dbLink);
> $testeOutPut = mysql_result($varQuery, 0, 'personName');
> return $testeOutPut;
> }
>
> echo fctSelect();
>
> ?>
>
>
> But if i include the conn settings inside the function everything
> works great. What am i missing here?
>
> Thanks in advance;
> HC

 

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

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