On Sunday 28 October 2001 12:57 pm, you wrote:

> It seems that when I try to connect to my database inside "function
> Table_Title()", my function cannot read the values of $server, $user,
> $pass, "$db or $table ???

you need to declare the variables as global.  See below and also see the 
manual to understand how global works.

> <?php
>
> $server = "localhost";
> $user = "MyAccount";
> $pass = "MyPassword";
> $db = "MyDatabase";
> $table = "bookmark_unit4";
>
> function Table_Title()
> {

   global $server,$user,$pass,$db,$table;


>  $myconnection = mysql_pconnect($server,$user,$pass);
>  mysql_select_db($db,$myconnection);
>
>  $news = mysql_query("SHOW TABLE STATUS FROM ".$db." LIKE '$table'");
>  while ($news_story = mysql_fetch_array($news))
>  {
>         $table_comment = $news_story['Comment'];
>  }
>
>     echo $table_comment;
>  //echo "Nothing";
> }
> ?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to