RE: [PHP-DB] Re: PostgreSQL error with PHP

2005-06-26 Thread Robbert van Andel
The error is in your function pg_connect
pg_connect(name=auth user=auth);

I'm not a PostgreSQL user but your connection string should be enclosed into
by quotes.  Documentation can be found at
http://us3.php.net/manual/en/function.pg-connect.php

Hope this helps,
Robbert

-Original Message-
From: Thomas Bonham [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 26, 2005 5:43 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Re: PostgreSQL error with PHP

I modafide the code some more and now with the following code I get this 
error.
CODE:
  htmlheadtitleLogin/title

/head
body
?php

pg_connect(name=auth); (user=auth);
?
/body
/html


Parse error: parse error, unexpected '=' in 
/var/www/html/thomas/cis166ae/database/secretdb.php on line 8

Thanks

Thomas Bonham wrote:
 Hello All,
 I'm trying to get php to connect to my PostgreSQL database.
 The code that I'm using is below.
 
 
htmlheadtitleLogin/title
 
/head
body
?php
$conn = dbname=auth user=auth;
 $db = pg_connect ( $conn );
?
/body
/html
 
 Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: 
 IDENT authentication failed for user auth in 
 /var/www/html/thomas/cis166ae/database/secretdb.php on line 8
 
 Below is how I set up my database.
 
 [EMAIL PROTECTED] # Su - postgres
 
 -bash-3.00$ createuser -D -A -E
 auth
 -bash-3.00$ createdb auth
 
 Thanks Helping

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Re: PostgreSQL error with PHP

2005-06-26 Thread Robbert van Andel
You might need to include the hostname and port.

-Original Message-
From: Thomas Bonham [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 26, 2005 6:48 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Re: PostgreSQL error with PHP

Thanks for the help.
The code now looks like this.
CODE:

htmlheadtitleLogin/title

/head
body
?php

$conn = pg_connect(user=auth dbname=auth password=redhat)
or die (Could not connect) ;
echo Connectd Successfully;
pg_close($conn);

?
/body
/html

And now the error I get is the following.


Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: 
IDENT authentication failed for user auth in 
/var/www/html/thomas/cis166ae/database/secretdb.php on line 8
Could not connect


Thomas

Robbert van Andel wrote:
 The error is in your function pg_connect
 pg_connect(name=auth user=auth);
 
 I'm not a PostgreSQL user but your connection string should be enclosed
into
 by quotes.  Documentation can be found at
 http://us3.php.net/manual/en/function.pg-connect.php
 
 Hope this helps,
 Robbert
 
 -Original Message-
 From: Thomas Bonham [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, June 26, 2005 5:43 PM
 To: php-db@lists.php.net
 Subject: [PHP-DB] Re: PostgreSQL error with PHP
 
 I modafide the code some more and now with the following code I get this 
 error.
 CODE:
   htmlheadtitleLogin/title
 
 /head
 body
 ?php
   
   pg_connect(name=auth); (user=auth);
 ?
 /body
 /html
 
 
 Parse error: parse error, unexpected '=' in 
 /var/www/html/thomas/cis166ae/database/secretdb.php on line 8
 
 Thanks
 
 Thomas Bonham wrote:
 
Hello All,
I'm trying to get php to connect to my PostgreSQL database.
The code that I'm using is below.


   htmlheadtitleLogin/title

   /head
   body
   ?php
   $conn = dbname=auth user=auth;
$db = pg_connect ( $conn );
   ?
   /body
   /html

Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: 
IDENT authentication failed for user auth in 
/var/www/html/thomas/cis166ae/database/secretdb.php on line 8

Below is how I set up my database.

[EMAIL PROTECTED] # Su - postgres

-bash-3.00$ createuser -D -A -E
auth
-bash-3.00$ createdb auth

Thanks Helping
 
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Re: PostgreSQL error with PHP

2005-06-26 Thread Robbert van Andel
Can you log into the PostgreSQL server from the console or command line?
Are you sure you are using the right username, password or host?

-Original Message-
From: Thomas Bonham [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 26, 2005 8:03 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Re: PostgreSQL error with PHP

I rewrote the code. This is the code and errors.
This is starting to get old, I have been working on this for over a week 
now.

CODE:

htmlheadtitleLogin/title

/head
body
?php

$conn = user=auth password=redhat
dbname=auth host=localhost port=5432;

$dbconn = pg_connect($conn);
echo Connected Successfully;


?
/body
/html

Error:

Warning: pg_connect(): Unable to connect to PostgreSQL server: could not 
connect to server: Connection refused Is the server running on host 
localhost and accepting TCP/IP connections on port 5432? in 
/var/www/html/thomas/cis166ae/database/secretdb.php on line 11
Connected Successfully


Thomas



Thomas Bonham wrote:
 I add the hostname and port, then I configure postgresql.conf and enable 
 the port 5432 line in the config file.
 
 So this is the new code.
 
 
htmlheadtitleLogin/title
 
/head
body
?php
 
 $conn = pg_connect(
 user=auth dbname=auth password=redhat host=thomas.example.com
 port=5432 ) or die (Could not connect) ;
 echo Connected Successfully;
 pg_close($conn);
 
?
/body
/html
 
 With the new error.
 
 Warning: pg_connect(): Unable to connect to PostgreSQL server: could not 
 connect to server: Connection refused Is the server running on host 
 thomas.example.com and accepting TCP/IP connections on port 5432? in 
 /var/www/html/thomas/cis166ae/database/secretdb.php on line 10
 Could not connect
 
 Thomas
 
 
 
 Robbert van Andel wrote:
 
 You might need to include the hostname and port.

 -Original Message-
 From: Thomas Bonham [mailto:[EMAIL PROTECTED] Sent: Sunday, 
 June 26, 2005 6:48 PM
 To: php-db@lists.php.net
 Subject: Re: [PHP-DB] Re: PostgreSQL error with PHP

 Thanks for the help.
 The code now looks like this.
 CODE:

 htmlheadtitleLogin/title

 /head
 body
 ?php
 
 $conn = pg_connect(user=auth dbname=auth password=redhat)
 or die (Could not connect) ;
 echo Connectd Successfully;
 pg_close($conn);
 
 ?
 /body
 /html

 And now the error I get is the following.


 Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: 
 IDENT authentication failed for user auth in 
 /var/www/html/thomas/cis166ae/database/secretdb.php on line 8
 Could not connect


 Thomas

 Robbert van Andel wrote:

 The error is in your function pg_connect
 pg_connect(name=auth user=auth);

 I'm not a PostgreSQL user but your connection string should be enclosed


 into

 by quotes.  Documentation can be found at
 http://us3.php.net/manual/en/function.pg-connect.php

 Hope this helps,
 Robbert

 -Original Message-
 From: Thomas Bonham [mailto:[EMAIL PROTECTED] Sent: Sunday, 
 June 26, 2005 5:43 PM
 To: php-db@lists.php.net
 Subject: [PHP-DB] Re: PostgreSQL error with PHP

 I modafide the code some more and now with the following code I get 
 this error.
 CODE:
  htmlheadtitleLogin/title

/head
body
?php
   
 pg_connect(name=auth); (user=auth);
?
/body
/html


 Parse error: parse error, unexpected '=' in 
 /var/www/html/thomas/cis166ae/database/secretdb.php on line 8

 Thanks

 Thomas Bonham wrote:


 Hello All,
 I'm trying to get php to connect to my PostgreSQL database.
 The code that I'm using is below.


  htmlheadtitleLogin/title

  /head
  body
  ?php
  $conn = dbname=auth user=auth;
   $db = pg_connect ( $conn );
  ?
  /body
  /html

 Warning: pg_connect(): Unable to connect to PostgreSQL server: 
 FATAL: IDENT authentication failed for user auth in 
 /var/www/html/thomas/cis166ae/database/secretdb.php on line 8

 Below is how I set up my database.

 [EMAIL PROTECTED] # Su - postgres

 -bash-3.00$ createuser -D -A -E
   auth
 -bash-3.00$ createdb auth

 Thanks Helping





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Using PHP to import a DB

2005-11-05 Thread Robbert van Andel
You could run a system command from the web browser to import the text file.
If you have access to PHPmyAdmin, you could use it to then import the file.
Or finally, you should be able to read the contents of the file into a
variable (if it's small enough) and then run the query using mysql_query.

My personal preference is phpmyadmin.  It's a very good database interface
and can be retrieved from http://www.phpmyadmin.net/home_page/

Robbert van Andel 

-Original Message-
From: Todd Cary [mailto:[EMAIL PROTECTED] 
Sent: Saturday, November 05, 2005 4:02 PM
To: php-db@lists.php.net
Cc: Chris Herron
Subject: [PHP-DB] Using PHP to import a DB

My client switched from a dedicated server to a shared server, so I 
cannot use the command line to import a DB that was produced with 
mysqldump.  Can I duplicate mysql -u user -p db  /tmp/mydb with php?

Any suggestions are greatly appreciated

Todd

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Using PHP to import a DB

2005-11-06 Thread Robbert van Andel
Yes, this is an upload of a local file.  I'm not sure if there is a way to
run the sql command inside the file if it's sitting on the server.  Keep in
mind that you may run into size upload restrictions (i.e. files larger than
2 megs, or whatever your webhost has set it to).  If that's the case, you
can separate out the sql commands from the file into separate files.  

-Original Message-
From: Todd Cary [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 06, 2005 8:43 AM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Using PHP to import a DB

Robert -

I installed phpmyadmin on the shared server, however I am not sure of 
the command to run the sql file, mybackup.sql, that was created on the 
dedicated server with mysqldump.

The docs as best as I can read them indicate that all I need to type 
into the Run SQL query text box is the name of the file 
(/tmp/mybackup.sql), however that produces an error.

Maybe the problem is that I FTP'd the file to the shared server and it 
should be on my local computer??

What have I overlooked?

Todd

Robbert van Andel wrote:
 You could run a system command from the web browser to import the text
file.
 If you have access to PHPmyAdmin, you could use it to then import the
file.
 Or finally, you should be able to read the contents of the file into a
 variable (if it's small enough) and then run the query using mysql_query.
 
 My personal preference is phpmyadmin.  It's a very good database interface
 and can be retrieved from http://www.phpmyadmin.net/home_page/
 
 Robbert van Andel 
 
 -Original Message-
 From: Todd Cary [mailto:[EMAIL PROTECTED] 
 Sent: Saturday, November 05, 2005 4:02 PM
 To: php-db@lists.php.net
 Cc: Chris Herron
 Subject: [PHP-DB] Using PHP to import a DB
 
 My client switched from a dedicated server to a shared server, so I 
 cannot use the command line to import a DB that was produced with 
 mysqldump.  Can I duplicate mysql -u user -p db  /tmp/mydb with php?
 
 Any suggestions are greatly appreciated
 
 Todd
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Using PHP to import a DB

2005-11-06 Thread Robbert van Andel
Do you have permission to create tables (I would assume so)?  Can you run
any successful queries (i.e. not using the file upload)?  If so, you might
need to check your configuration file, or you might have some file size
limitations, as I mentioned in my previous email.

-Original Message-
From: Todd Cary [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 06, 2005 8:57 AM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Using PHP to import a DB

Robert -

I used the backup file on my desktop computer and the browse button. 
After the upload was over, I got this message:

Your SQL query has been executed successfully:
The content of your file has been inserted. (sfyc_data_20051105.sql: 
1 Instructions)

However the tables were not created in the DB.  I must be missing 
something simple here!

A sample of the backup file is as follows:

CREATE TABLE ACCESS (
   AC_REF int(11) NOT NULL auto_increment,
   AC_MEMBER_NUM varchar(10) default NULL,
   AC_TYPE varchar(15) default NULL,
   AC_CHANGETIME timestamp(14) NOT NULL,
   PRIMARY KEY  (AC_REF)
) TYPE=MyISAM;

--
-- Dumping data for table 'ACCESS'
--


INSERT INTO ACCESS VALUES (2230,'441','VIEWMEM',2004052332);

Todd
Robbert van Andel wrote:
 You could run a system command from the web browser to import the text
file.
 If you have access to PHPmyAdmin, you could use it to then import the
file.
 Or finally, you should be able to read the contents of the file into a
 variable (if it's small enough) and then run the query using mysql_query.
 
 My personal preference is phpmyadmin.  It's a very good database interface
 and can be retrieved from http://www.phpmyadmin.net/home_page/
 
 Robbert van Andel 
 
 -Original Message-
 From: Todd Cary [mailto:[EMAIL PROTECTED] 
 Sent: Saturday, November 05, 2005 4:02 PM
 To: php-db@lists.php.net
 Cc: Chris Herron
 Subject: [PHP-DB] Using PHP to import a DB
 
 My client switched from a dedicated server to a shared server, so I 
 cannot use the command line to import a DB that was produced with 
 mysqldump.  Can I duplicate mysql -u user -p db  /tmp/mydb with php?
 
 Any suggestions are greatly appreciated
 
 Todd
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] SELECT html table

2005-12-04 Thread Robbert van Andel
There's a couple of ways to do this.  For the row color you would set that
as you looped through the returned rows.  Using the pear db class:

$count = 0;
echo table\n;
while($db-fetchInto($data)) {
$count++;
if($count % 2 == 0) {
$bgColor = background-color:#dcdcdc;
}
else {
$bgColor = background-color:transparent;
}
echo tr style='$dgColor'\n;
foreach($data as value) {
echo td . htmlentities($value) . /td\n;
}
echo /tr\n;
}

As for the limiting of rows, you would use the limit statement (assuming
you're using a DBMS that supports it).

Hopefully this helps,
Robbert van Andel

-Original Message-
From: Ron Piggott (PHP) [mailto:[EMAIL PROTECTED] 
Sent: Sunday, December 04, 2005 10:39 AM
To: PHP DB
Subject: [PHP-DB] SELECT  html table

I have two questions.  

I would like to display the contents of my table with the first row
being grey in background and the next row being white and the third row
being grey, fourth being white, etc.  I am not sure how to do this.

Secondly I only want the first 20 records to be displayed at a time and
then I want to create a NEXT link for the next 20 records (21-40) ...
any idea how you would use the SELECT command to do this?

Ron

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php