Dorac Posted February 9, 2008 Share Posted February 9, 2008 Im really stumped about this one. Really cant get it to work and its not that im changing the variable.. (even tho its a constant ) weird... here is my code. Please please pretty please help. Thanks a mill. Its on a remote server. Ive taken the host ip and pass out for obvious reasons. //index.php <?php include("includes/config.php"); include("includes/functions.php"); $connection = pg_connect("host=*.*.*.* port=5432 dbname=bookdesign user=bookstar password=****"); include("side_pages/top_bar.php"); //side bar already included ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Book Design</title> <link href="style.css" rel="stylesheet" type="text/css" /></head> <body> <table width="100%" border="0"> <tr> <td width="180" align="left" valign="top" class="sidebar"><br /> <?php include("side_pages/side_bar.php"); ?> <br /></td> <td align="center" valign="top"><span class="headlines">News</span><br /> <br /> <?php getnews(); ?> </td> </tr> </table> </body> </html> as you notice there is no problem here, i can connect using the user and pass given... but when i use a function it gives "Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: FATAL: password authentication failed for user "SYSTEM" in C:\wamp\www\library\includes\functions.php on line 27 Couldn't Connect" // config.php <?php $user_for_server_is = "myuser"; $pass_for_server_is = "****"; $the_server_is = "*.*.*.*"; $connect_on_port = "5432"; $database = "BookDesign"; /////////////////////////////////// define(HOST,$the_server_is); define(PORT,$connect_on_port); define(USER,$user_for_server_is); define(PASS,$pass_for_server_is); define(DATABASE,$database_is); ?> thats all fine and dandy... now functions.php gives trouble :-/ function getnews() { $connection = pg_connect("host=".HOST." port=".PORT." dbname=".DATABASE." user=".USER." password=".PASS) or die("Couldn't Connect"); $result = pg_query("SELECT title, newsdate, story FROM news"); $result_row = pg_fetch_row($result); pg_close($result); echo (' <td class="newsbox"> <h3 align="center"><strong>'.$result_row[0].' - '.$result_row[1].'</strong></h3> <table width="96%" align="center"> <tr> <td> '.$result_row[2].' </td> </tr> </table> <br /></td> '); } ?> if i put the connect host port etc directly in config.php it works perfect. but if i put it in functions and call the function it error : "Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: FATAL: password authentication failed for user "SYSTEM" in C:\wamp\www\library\includes\functions.php on line 27 Couldn't Connect" Any help will be much appreciated. Quote Link to comment Share on other sites More sharing options...
trq Posted February 9, 2008 Share Posted February 9, 2008 You are including config.php into functions.php ? Quote Link to comment Share on other sites More sharing options...
Dorac Posted February 9, 2008 Author Share Posted February 9, 2008 Nope. Should i be? I tried it now... still no change. still thinks im trying to log in as SYSTEM. very very weird, ive never come across a problem like this before. ??? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.