[PHP-DB] small question php/postgreSQL

2006-11-07 Thread Desmond Coughlan
X-No-Archve: true
   
  Hi,
   
  I've been trying to get a small DB up and working with PhP.  It's a library, 
and so far, I can't get past the stage of displaying a page.  I try the 'hello 
world' example, and it displays.  I then populate a DB and can access it via 
psql .. 
   
  cdi= SELECT * FROM stock ;
-[ RECORD 1 ]-+---
stock_ids | 1
isbn_no   | 10101010
code_livre| 23455
titre | toto goes to Hollywood
editeur   | editions toto
collection| collection toto
auteur_nom| smith
auteur_prenom | john
matiere   | ang
media_type| li
-[ RECORD 2 ]-+---
stock_ids | 2
isbn_no   | 10536278
code_livre| 24874
titre | toto comes back from Hollywood
editeur   | editions baba
collection| collection toto
auteur_nom| martin
auteur_prenom | peter
matiere   | fre
media_type| dvd

  OK, I then write the following script  
   
  ?php
  pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't Connect: 
.pg
_last_error());
$query=SELECT * FROM stock;
$query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].br /;
echo blah .$row['code_livre'].br /;
}
  ?

  (sorry not to put that in italics or whatever...)
   
  ... and put it in the document root of my webserver, under php_experimental.  
   
  I get a blank page.  The apache weblogs look like ... 
   
  192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET 
/php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible; MSIE 
6.0; Windows NT 5.0)

  There's something obvious that I'm missing.  Any ideas ..? 
  
Thanks.
  
D.


-
 Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses.

[PHP-DB] re: small question php/postgreSQL (basic question, not small)

2006-11-07 Thread JeRRy
  Date:  Tue, 7 Nov 2006 10:38:18 +0100 (CET)From:  Desmond Coughlan 
[EMAIL PROTECTED]To:  php php-db@lists.php.netSubject:  small 
question php/postgreSQL 
  Hi,
   
  I've been trying to get a small DB up and working with PhP.  It's a 
library, and so far, I can't get past the stage of displaying a page.  I 
try the 'hello world' example, and it displays.  I then populate a DB 
and can access it via psql .. 
   
  cdi= SELECT * FROM stock ;
-[ RECORD 1 ]-+---
stock_ids | 1
isbn_no   | 10101010
code_livre| 23455
titre | toto goes to Hollywood
editeur   | editions toto
collection| collection toto
auteur_nom| smith
auteur_prenom | john
matiere   | ang
media_type| li
-[ RECORD 2 ]-+---
stock_ids | 2
isbn_no   | 10536278
code_livre| 24874
titre | toto comes back from Hollywood
editeur   | editions baba
collection| collection toto
auteur_nom| martin
auteur_prenom | peter
matiere   | fre
media_type| dvd

  OK, I then write the following script  
   
  ?php
  pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't 
Connect: .pg
_last_error());
$query=SELECT * FROM stock;
$query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].br /;
echo blah .$row['code_livre'].br /;
}
  ?

  (sorry not to put that in italics or whatever...)
   
  ... and put it in the document root of my webserver, under 
php_experimental.  
   
  I get a blank page.  The apache weblogs look like ... 
   
  192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET 
/php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible; MSIE 
6.0; 
Windows NT 5.0)

  There's something obvious that I'm missing.  Any ideas ..? 
  
Thanks.
  
D.

--
   
  re:
   
?php
  pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't 
Connect: .pg
_last_error());
$query=SELECT * FROM stock;
$query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].br /;
echo blah .$row['code_livre'].br /;
}
  ?

  Simple, isbn_no and code_livre need to be defined in your code.  Otherwise 
PHP don't know what your looking for.
   
  There is PLENTY of docs online to show you how to display items in a DB.  
Hello World is basic, too basic to use as an example and is a poor one to use.  
If your nerw you have to go a bit more into it than Hello World code.  (which 
in my opinion gets you know-where) been there done that.
   
  Google how to display items in a DB in PHP and shoot you get some handy 
things.
   
  I just feel this question is not required here when google has all the 
answers like this.
   
  Jerry


[PHP-DB] category management using MySQL and PHP

2006-11-07 Thread Tamkhane, Pravin
Hi All,
I am working on small web project based on PHP  MySQL where user is looking 
for items in certain categories and he specifies the category in search box, 
the search result should return all items from that category  sub-categories 
of it. 

I thought of defining a unique identifier to each category and use them in 
search but it may work well only for base categories, for hierarchical/sub  
categories I doubt it will make it simple. Any hints on how can I solve this? 
Any pointers would be greatly helpful.

Thanks in advance,
Pravin

RE: [PHP-DB] category management using MySQL and PHP

2006-11-07 Thread Ankur Dave


Hi,

I am not sure this is what you want or some else...

You can design the table like this so it will be faster to search.
And make the subcategory as linked to category. Means the foreign key.

++--+--+-+--
---++
| Field  | Type | Null | Key | Default
| Extra  |
++--+--+-+--
---++
| categoryid | int(11)  | NO   | PRI | NULL
| auto_increment |
| categoryname   | varchar(50)  | NO   | UNI | NULL
||


+-+-+--+-+-+
+
| Field   | Type| Null | Key | Default |
Extra  |
+-+-+--+-+-+
+
| subcategoryid   | int(11) | NO   | PRI | NULL|
auto_increment |
| categoryid  | int(11) | NO   | MUL | NULL|
|
| subcategoryname | varchar(50) | NO   | | NULL|
|

Then while search you can make a query with join and search the things
efficiently.


10x, | Ankur Dave | http://ullu.wordpress.com


-Original Message-
From: Tamkhane, Pravin [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 07, 2006 7:38 PM
To: php-db@lists.php.net
Subject: [PHP-DB] category management using MySQL and PHP

Hi All,
I am working on small web project based on PHP  MySQL where user is
looking for items in certain categories and he specifies the category in
search box, the search result should return all items from that category
 sub-categories of it.

I thought of defining a unique identifier to each category and use them
in search but it may work well only for base categories, for
hierarchical/sub  categories I doubt it will make it simple. Any hints
on how can I solve this? Any pointers would be greatly helpful.

Thanks in advance,
Pravin


The information contained in, or attached to, this e-mail, contains 
confidential information and is intended solely for the use of the individual 
or entity to whom they are addressed and is subject to legal privilege. If you 
have received this e-mail in error you should notify the sender immediately by 
reply e-mail, delete the message from your system and notify your system 
manager. Please do not copy it for any purpose, or disclose its contents to any 
other person. The views or opinions presented in this e-mail are solely those 
of the author and do not necessarily represent those of the company. The 
recipient should check this e-mail and any attachments for the presence of 
viruses. The company accepts no liability for any damage caused, directly or 
indirectly, by any virus transmitted in this email.

www.aztecsoft.com

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



RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)

2006-11-07 Thread Bastien Koert
The code does need to know what the fields are...I think a more likely issue 
is the query for some reason, also change the $query to result in the query 
statement


try

$result=pg_query($query) or die(pg_error());  //to see if there are any 
errors with the query


while($row=pg_fetch_array($result,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].br /;
 echo blah .$row['code_livre'].br /;
}else{
 echo No rows found;
}


bastien



From: JeRRy [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] re: small question php/postgreSQL (basic question, not 
small)

Date: Tue, 7 Nov 2006 23:18:58 +1100 (EST)

  Date:  Tue, 7 Nov 2006 10:38:18 +0100 (CET)From:  Desmond 
Coughlan [EMAIL PROTECTED]To:  php php-db@lists.php.net   
 Subject:  small question php/postgreSQL

  Hi,

  I've been trying to get a small DB up and working with PhP.  It's a
library, and so far, I can't get past the stage of displaying a page.  I
try the 'hello world' example, and it displays.  I then populate a DB
and can access it via psql ..

  cdi= SELECT * FROM stock ;
-[ RECORD 1 ]-+---
stock_ids | 1
isbn_no   | 10101010
code_livre| 23455
titre | toto goes to Hollywood
editeur   | editions toto
collection| collection toto
auteur_nom| smith
auteur_prenom | john
matiere   | ang
media_type| li
-[ RECORD 2 ]-+---
stock_ids | 2
isbn_no   | 10536278
code_livre| 24874
titre | toto comes back from Hollywood
editeur   | editions baba
collection| collection toto
auteur_nom| martin
auteur_prenom | peter
matiere   | fre
media_type| dvd

  OK, I then write the following script 

  ?php
  pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
Connect: .pg
_last_error());
$query=SELECT * FROM stock;
$query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].br /;
echo blah .$row['code_livre'].br /;
}
  ?

  (sorry not to put that in italics or whatever...)

  ... and put it in the document root of my webserver, under
php_experimental.

  I get a blank page.  The apache weblogs look like ...

  192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET
/php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible; 
MSIE 6.0;

Windows NT 5.0)

  There's something obvious that I'm missing.  Any ideas ..?

Thanks.

D.

--

  re:

?php
  pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
Connect: .pg
_last_error());
$query=SELECT * FROM stock;
$query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].br /;
echo blah .$row['code_livre'].br /;
}
  ?

  Simple, isbn_no and code_livre need to be defined in your code.  
Otherwise PHP don't know what your looking for.


  There is PLENTY of docs online to show you how to display items in a DB. 
 Hello World is basic, too basic to use as an example and is a poor one to 
use.  If your nerw you have to go a bit more into it than Hello World code. 
 (which in my opinion gets you know-where) been there done that.


  Google how to display items in a DB in PHP and shoot you get some handy 
things.


  I just feel this question is not required here when google has all the 
answers like this.


  Jerry


_
Ready for the world's first international mobile film festival celebrating 
the creative potential of today's youth? Check out Mobile Jam Fest for your 
a chance to WIN $10,000! www.mobilejamfest.com


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



[PHP-DB] RE : RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)

2006-11-07 Thread Desmond Coughlan
X-No-Archive: true
   
  That doesn't work, either.  Still the blank page.  Hmm ... the file is in the 
right place../usr/local/www/data ... 'cos all of the other files (*.html one an 
d all) are served from there, and they're available to the outside world.
   
  D.

Bastien Koert [EMAIL PROTECTED] a écrit :
  The code does need to know what the fields are...I think a more likely issue 
is the query for some reason, also change the $query to result in the query 
statement

try

$result=pg_query($query) or die(pg_error()); //to see if there are any 
errors with the query

while($row=pg_fetch_array($result,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].
;
echo blah .$row['code_livre'].
;
}else{
echo No rows found;
}


bastien


From: JeRRy 
To: php-db@lists.php.net
Subject: [PHP-DB] re: small question php/postgreSQL (basic question, not 
small)
Date: Tue, 7 Nov 2006 23:18:58 +1100 (EST)

 Date: Tue, 7 Nov 2006 10:38:18 +0100 (CET) From: Desmond 
Coughlan To: php 

 Subject: small question php/postgreSQL
 Hi,

 I've been trying to get a small DB up and working with PhP. It's a
library, and so far, I can't get past the stage of displaying a page. I
try the 'hello world' example, and it displays. I then populate a DB
and can access it via psql ..

 cdi= SELECT * FROM stock ;
-[ RECORD 1 ]-+---
stock_ids | 1
isbn_no | 10101010
code_livre | 23455
titre | toto goes to Hollywood
editeur | editions toto
collection | collection toto
auteur_nom | smith
auteur_prenom | john
matiere | ang
media_type | li
-[ RECORD 2 ]-+---
stock_ids | 2
isbn_no | 10536278
code_livre | 24874
titre | toto comes back from Hollywood
editeur | editions baba
collection | collection toto
auteur_nom | martin
auteur_prenom | peter
matiere | fre
media_type | dvd

 OK, I then write the following script 

  pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
Connect: .pg
_last_error());
$query=SELECT * FROM stock;
$query=pg_query($query);
 // start the output
 while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].
;
echo blah .$row['code_livre'].
;
}
 ?

 (sorry not to put that in italics or whatever...)

 ... and put it in the document root of my webserver, under
php_experimental.

 I get a blank page. The apache weblogs look like ...

 192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET
/php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible; 
MSIE 6.0;
Windows NT 5.0)

 There's something obvious that I'm missing. Any ideas ..?

Thanks.

D.

--

 re:

  pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
Connect: .pg
_last_error());
$query=SELECT * FROM stock;
$query=pg_query($query);
 // start the output
 while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].
;
echo blah .$row['code_livre'].
;
}
 ?

 Simple, isbn_no and code_livre need to be defined in your code. 
Otherwise PHP don't know what your looking for.

 There is PLENTY of docs online to show you how to display items in a DB. 
 Hello World is basic, too basic to use as an example and is a poor one to 
use. If your nerw you have to go a bit more into it than Hello World code. 
 (which in my opinion gets you know-where) been there done that.

 Google how to display items in a DB in PHP and shoot you get some handy 
things.

 I just feel this question is not required here when google has all the 
answers like this.

 Jerry

_
Ready for the world's first international mobile film festival celebrating 
the creative potential of today's youth? Check out Mobile Jam Fest for your 
a chance to WIN $10,000! www.mobilejamfest.com

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




-
 Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses.

RE: [PHP-DB] RE : RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)

2006-11-07 Thread Bastien Koert

is your server set to work with php files?

Bastien



From: Desmond Coughlan [EMAIL PROTECTED]
To: Bastien Koert [EMAIL PROTECTED], [EMAIL PROTECTED],  
php-db@lists.php.net
Subject: [PHP-DB] RE : RE: [PHP-DB] re: small question php/postgreSQL 
(basic question, not small)

Date: Tue, 7 Nov 2006 16:38:24 +0100 (CET)

X-No-Archive: true

  That doesn't work, either.  Still the blank page.  Hmm ... the file is 
in the right place../usr/local/www/data ... 'cos all of the other files 
(*.html one an d all) are served from there, and they're available to the 
outside world.


  D.

Bastien Koert [EMAIL PROTECTED] a écrit :
  The code does need to know what the fields are...I think a more likely 
issue

is the query for some reason, also change the $query to result in the query
statement

try

$result=pg_query($query) or die(pg_error()); //to see if there are any
errors with the query

while($row=pg_fetch_array($result,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].
;
echo blah .$row['code_livre'].
;
}else{
echo No rows found;
}


bastien


From: JeRRy
To: php-db@lists.php.net
Subject: [PHP-DB] re: small question php/postgreSQL (basic question, not
small)
Date: Tue, 7 Nov 2006 23:18:58 +1100 (EST)

 Date: Tue, 7 Nov 2006 10:38:18 +0100 (CET) From: Desmond
Coughlan To: php

 Subject: small question php/postgreSQL
 Hi,

 I've been trying to get a small DB up and working with PhP. It's a
library, and so far, I can't get past the stage of displaying a page. I
try the 'hello world' example, and it displays. I then populate a DB
and can access it via psql ..

 cdi= SELECT * FROM stock ;
-[ RECORD 1 ]-+---
stock_ids | 1
isbn_no | 10101010
code_livre | 23455
titre | toto goes to Hollywood
editeur | editions toto
collection | collection toto
auteur_nom | smith
auteur_prenom | john
matiere | ang
media_type | li
-[ RECORD 2 ]-+---
stock_ids | 2
isbn_no | 10536278
code_livre | 24874
titre | toto comes back from Hollywood
editeur | editions baba
collection | collection toto
auteur_nom | martin
auteur_prenom | peter
matiere | fre
media_type | dvd

 OK, I then write the following script 

  pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
Connect: .pg
_last_error());
$query=SELECT * FROM stock;
$query=pg_query($query);
 // start the output
 while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].
;
echo blah .$row['code_livre'].
;
}
 ?

 (sorry not to put that in italics or whatever...)

 ... and put it in the document root of my webserver, under
php_experimental.

 I get a blank page. The apache weblogs look like ...

 192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET
/php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible;
MSIE 6.0;
Windows NT 5.0)

 There's something obvious that I'm missing. Any ideas ..?

Thanks.

D.

--

 re:

  pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
Connect: .pg
_last_error());
$query=SELECT * FROM stock;
$query=pg_query($query);
 // start the output
 while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].
;
echo blah .$row['code_livre'].
;
}
 ?

 Simple, isbn_no and code_livre need to be defined in your code.
Otherwise PHP don't know what your looking for.

 There is PLENTY of docs online to show you how to display items in a DB.
 Hello World is basic, too basic to use as an example and is a poor one 
to
use. If your nerw you have to go a bit more into it than Hello World 
code.

 (which in my opinion gets you know-where) been there done that.

 Google how to display items in a DB in PHP and shoot you get some handy
things.

 I just feel this question is not required here when google has all the
answers like this.

 Jerry

_
Ready for the world's first international mobile film festival celebrating
the creative potential of today's youth? Check out Mobile Jam Fest for your
a chance to WIN $10,000! www.mobilejamfest.com

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




-
 Découvrez une nouvelle façon d'obtenir des réponses à toutes vos 
questions ! Profitez des connaissances, des opinions et des expériences des 
internautes sur Yahoo! Questions/Réponses.


_
Not only does Windows Live™ OneCare™ provide all-in-one PC care to keep your 
computer protected and well-maintained, but it also makes creating backup 
files a breeze. Try it today! 
http://ideas.live.com/programpage.aspx?versionid=b2456790-90e6-4d28-9219-5d7207d94d45mkt=en-ca


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



[PHP-DB] RE : RE: [PHP-DB] RE : RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)

2006-11-07 Thread Desmond Coughlan
X-No-Archive: true
   
  Yep.  The famous phpinfo file works like a charm.
  
D.
   
  
Bastien Koert [EMAIL PROTECTED] a écrit :
  is your server set to work with php files?

Bastien


From: Desmond Coughlan 
To: Bastien Koert , [EMAIL PROTECTED], 
php-db@lists.php.net
Subject: [PHP-DB] RE : RE: [PHP-DB] re: small question php/postgreSQL 
(basic question, not small)
Date: Tue, 7 Nov 2006 16:38:24 +0100 (CET)

X-No-Archive: true

 That doesn't work, either. Still the blank page. Hmm ... the file is 
in the right place../usr/local/www/data ... 'cos all of the other files 
(*.html one an d all) are served from there, and they're available to the 
outside world.

 D.

Bastien Koert a écrit :
 The code does need to know what the fields are...I think a more likely 
issue
is the query for some reason, also change the $query to result in the query
statement

try

$result=pg_query($query) or die(pg_error()); //to see if there are any
errors with the query

while($row=pg_fetch_array($result,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].
;
echo blah .$row['code_livre'].
;
}else{
echo No rows found;
}


bastien


 From: JeRRy
 To: php-db@lists.php.net
 Subject: [PHP-DB] re: small question php/postgreSQL (basic question, not
 small)
 Date: Tue, 7 Nov 2006 23:18:58 +1100 (EST)
 
  Date: Tue, 7 Nov 2006 10:38:18 +0100 (CET) From: Desmond
 Coughlan To: php

  Subject: small question php/postgreSQL
  Hi,
 
  I've been trying to get a small DB up and working with PhP. It's a
 library, and so far, I can't get past the stage of displaying a page. I
 try the 'hello world' example, and it displays. I then populate a DB
 and can access it via psql ..
 
  cdi= SELECT * FROM stock ;
 -[ RECORD 1 ]-+---
 stock_ids | 1
 isbn_no | 10101010
 code_livre | 23455
 titre | toto goes to Hollywood
 editeur | editions toto
 collection | collection toto
 auteur_nom | smith
 auteur_prenom | john
 matiere | ang
 media_type | li
 -[ RECORD 2 ]-+---
 stock_ids | 2
 isbn_no | 10536278
 code_livre | 24874
 titre | toto comes back from Hollywood
 editeur | editions baba
 collection | collection toto
 auteur_nom | martin
 auteur_prenom | peter
 matiere | fre
 media_type | dvd
 
  OK, I then write the following script 
 
   pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
 Connect: .pg
 _last_error());
 $query=SELECT * FROM stock;
 $query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
;
 echo blah .$row['code_livre'].
;
 }
  ?
 
  (sorry not to put that in italics or whatever...)
 
  ... and put it in the document root of my webserver, under
 php_experimental.
 
  I get a blank page. The apache weblogs look like ...
 
  192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET
 /php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible;
 MSIE 6.0;
 Windows NT 5.0)
 
  There's something obvious that I'm missing. Any ideas ..?
 
 Thanks.
 
 D.
 
 --
 
  re:
 
   pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
 Connect: .pg
 _last_error());
 $query=SELECT * FROM stock;
 $query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
;
 echo blah .$row['code_livre'].
;
 }
  ?
 
  Simple, isbn_no and code_livre need to be defined in your code.
 Otherwise PHP don't know what your looking for.
 
  There is PLENTY of docs online to show you how to display items in a DB.
  Hello World is basic, too basic to use as an example and is a poor one 
to
 use. If your nerw you have to go a bit more into it than Hello World 
code.
  (which in my opinion gets you know-where) been there done that.
 
  Google how to display items in a DB in PHP and shoot you get some handy
 things.
 
  I just feel this question is not required here when google has all the
 answers like this.
 
  Jerry

_
Ready for the world's first international mobile film festival celebrating
the creative potential of today's youth? Check out Mobile Jam Fest for your
a chance to WIN $10,000! www.mobilejamfest.com

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




-
 Découvrez une nouvelle façon d'obtenir des réponses à toutes vos 
questions ! Profitez des connaissances, des opinions et des expériences des 
internautes sur Yahoo! Questions/Réponses.

_
Not only does Windows Live™ OneCare™ provide all-in-one PC care to keep your 
computer protected and well-maintained, but it also makes creating backup 
files a breeze. Try it today! 
http://ideas.live.com/programpage.aspx?versionid=b2456790-90e6-4d28-9219-5d7207d94d45mkt=en-ca




-- 
Des Coughlan 
  [EMAIL PROTECTED]

  Un client de plus, c'est un relou de plus...



Re: [PHP-DB]: small question php/postgreSQL

2006-11-07 Thread Tony Grimes
Is your server configured to display errors? Try adding this at the top of
your script:

ini_set('display_errors',true);

It won't catch syntax errors, but it should help. Also, try adding this to
the top of your script:

echo 'test';

If you still get a blank page, then it's probably not a problem with your
actual script. Maybe your configuration.

Tony


On 11/7/06 8:38 AM, Desmond Coughlan [EMAIL PROTECTED] wrote:

 X-No-Archive: true
  
 That doesn't work, either.  Still the blank page.  Hmm ... the file is in the
 right place../usr/local/www/data ... 'cos all of the other files (*.html one
 an d all) are served from there, and they're available to the outside world.
  
 D.
 
 Bastien Koert [EMAIL PROTECTED] a écrit :
 The code does need to know what the fields are...I think a more likely issue
 is the query for some reason, also change the $query to result in the query
 statement
 
 try
 
 $result=pg_query($query) or die(pg_error()); //to see if there are any
 errors with the query
 
 while($row=pg_fetch_array($result,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }else{
 echo No rows found;
 }
 
 
 bastien
 
 
 From: JeRRy 
 To: php-db@lists.php.net
 Subject: [PHP-DB] re: small question php/postgreSQL (basic question, not
 small)
 Date: Tue, 7 Nov 2006 23:18:58 +1100 (EST)
 
 Date: Tue, 7 Nov 2006 10:38:18 +0100 (CET) From: Desmond
 Coughlan To: php
 
 Subject: small question php/postgreSQL
 Hi,
 
 I've been trying to get a small DB up and working with PhP. It's a
 library, and so far, I can't get past the stage of displaying a page. I
 try the 'hello world' example, and it displays. I then populate a DB
 and can access it via psql ..
 
 cdi= SELECT * FROM stock ;
 -[ RECORD 1 ]-+---
 stock_ids | 1
 isbn_no | 10101010
 code_livre | 23455
 titre | toto goes to Hollywood
 editeur | editions toto
 collection | collection toto
 auteur_nom | smith
 auteur_prenom | john
 matiere | ang
 media_type | li
 -[ RECORD 2 ]-+---
 stock_ids | 2
 isbn_no | 10536278
 code_livre | 24874
 titre | toto comes back from Hollywood
 editeur | editions baba
 collection | collection toto
 auteur_nom | martin
 auteur_prenom | peter
 matiere | fre
 media_type | dvd
 
 OK, I then write the following script 
 
 pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
 Connect: .pg
 _last_error());
 $query=SELECT * FROM stock;
 $query=pg_query($query);
 // start the output
 while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }
 ?
 
 (sorry not to put that in italics or whatever...)
 
 ... and put it in the document root of my webserver, under
 php_experimental.
 
 I get a blank page. The apache weblogs look like ...
 
 192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET
 /php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible;
 MSIE 6.0;
 Windows NT 5.0)
 
 There's something obvious that I'm missing. Any ideas ..?
 
 Thanks.
 
 D.
 
 --
 
 re:
 
 pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
 Connect: .pg
 _last_error());
 $query=SELECT * FROM stock;
 $query=pg_query($query);
 // start the output
 while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }
 ?
 
 Simple, isbn_no and code_livre need to be defined in your code.
 Otherwise PHP don't know what your looking for.
 
 There is PLENTY of docs online to show you how to display items in a DB.
 Hello World is basic, too basic to use as an example and is a poor one to
 use. If your nerw you have to go a bit more into it than Hello World code.
 (which in my opinion gets you know-where) been there done that.
 
 Google how to display items in a DB in PHP and shoot you get some handy
 things.
 
 I just feel this question is not required here when google has all the
 answers like this.
 
 Jerry
 
 _
 Ready for the world's first international mobile film festival celebrating
 the creative potential of today's youth? Check out Mobile Jam Fest for your
 a chance to WIN $10,000! www.mobilejamfest.com

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



[PHP-DB] RE : Re: [PHP-DB]: small question php/postgreSQL

2006-11-07 Thread Desmond Coughlan
X-No-Archive: true
   
  OK, that gives a blank page, too... which is puzzling, 'cos I tried 
'hello.php' before getting into the db 'thang', and I saw the text on the 
screen.
   
  Well .. back to the drawing board... 
   
  D.

Tony Grimes [EMAIL PROTECTED] a écrit :
  Is your server configured to display errors? Try adding this at the top of
your script:

ini_set('display_errors',true);

It won't catch syntax errors, but it should help. Also, try adding this to
the top of your script:

echo 'test';

If you still get a blank page, then it's probably not a problem with your
actual script. Maybe your configuration.

Tony


On 11/7/06 8:38 AM, Desmond Coughlan wrote:

 X-No-Archive: true
 
 That doesn't work, either. Still the blank page. Hmm ... the file is in the
 right place../usr/local/www/data ... 'cos all of the other files (*.html one
 an d all) are served from there, and they're available to the outside world.
 
 D.
 
 Bastien Koert a écrit :
 The code does need to know what the fields are...I think a more likely issue
 is the query for some reason, also change the $query to result in the query
 statement
 
 try
 
 $result=pg_query($query) or die(pg_error()); //to see if there are any
 errors with the query
 
 while($row=pg_fetch_array($result,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }else{
 echo No rows found;
 }
 
 
 bastien
 
 
 From: JeRRy 
 To: php-db@lists.php.net
 Subject: [PHP-DB] re: small question php/postgreSQL (basic question, not
 small)
 Date: Tue, 7 Nov 2006 23:18:58 +1100 (EST)
 
 Date: Tue, 7 Nov 2006 10:38:18 +0100 (CET) From: Desmond
 Coughlan To: php
 
 Subject: small question php/postgreSQL
 Hi,
 
 I've been trying to get a small DB up and working with PhP. It's a
 library, and so far, I can't get past the stage of displaying a page. I
 try the 'hello world' example, and it displays. I then populate a DB
 and can access it via psql ..
 
 cdi= SELECT * FROM stock ;
 -[ RECORD 1 ]-+---
 stock_ids | 1
 isbn_no | 10101010
 code_livre | 23455
 titre | toto goes to Hollywood
 editeur | editions toto
 collection | collection toto
 auteur_nom | smith
 auteur_prenom | john
 matiere | ang
 media_type | li
 -[ RECORD 2 ]-+---
 stock_ids | 2
 isbn_no | 10536278
 code_livre | 24874
 titre | toto comes back from Hollywood
 editeur | editions baba
 collection | collection toto
 auteur_nom | martin
 auteur_prenom | peter
 matiere | fre
 media_type | dvd
 
 OK, I then write the following script 
 
 pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
 Connect: .pg
 _last_error());
 $query=SELECT * FROM stock;
 $query=pg_query($query);
 // start the output
 while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }
 ?
 
 (sorry not to put that in italics or whatever...)
 
 ... and put it in the document root of my webserver, under
 php_experimental.
 
 I get a blank page. The apache weblogs look like ...
 
 192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET
 /php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible;
 MSIE 6.0;
 Windows NT 5.0)
 
 There's something obvious that I'm missing. Any ideas ..?
 
 Thanks.
 
 D.
 
 --
 
 re:
 
 pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
 Connect: .pg
 _last_error());
 $query=SELECT * FROM stock;
 $query=pg_query($query);
 // start the output
 while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }
 ?
 
 Simple, isbn_no and code_livre need to be defined in your code.
 Otherwise PHP don't know what your looking for.
 
 There is PLENTY of docs online to show you how to display items in a DB.
 Hello World is basic, too basic to use as an example and is a poor one to
 use. If your nerw you have to go a bit more into it than Hello World code.
 (which in my opinion gets you know-where) been there done that.
 
 Google how to display items in a DB in PHP and shoot you get some handy
 things.
 
 I just feel this question is not required here when google has all the
 answers like this.
 
 Jerry
 
 _
 Ready for the world's first international mobile film festival celebrating
 the creative potential of today's youth? Check out Mobile Jam Fest for your
 a chance to WIN $10,000! www.mobilejamfest.com

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




-- 
Des Coughlan 
  [EMAIL PROTECTED]

  Un client de plus, c'est un relou de plus...


-
 Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son 
interface révolutionnaire.

Re: [PHP-DB] RE : Re: [PHP-DB]: small question php/postgreSQL

2006-11-07 Thread Tony Grimes
Alright, now try commenting out all the script except for the ini_set and
echo 'test' at the top. There still might be a syntax error in the code.

Essentially, you want to do whatever you can to get the page to display a
simple message. Then, work backwards until you get the error/blank page.

If you can't get a message to display, try copying the script from hello.php
to right into your new script. That should give you enough to troubleshoot.

Tony


On 11/7/06 9:00 AM, Desmond Coughlan [EMAIL PROTECTED] wrote:

 X-No-Archive: true
  
 OK, that gives a blank page, too... which is puzzling, 'cos I tried
 'hello.php' before getting into the db 'thang', and I saw the text on the
 screen.
  
 Well .. back to the drawing board...
  
 D.
 
 Tony Grimes [EMAIL PROTECTED] a écrit :
 Is your server configured to display errors? Try adding this at the top of
 your script:
 
 ini_set('display_errors',true);
 
 It won't catch syntax errors, but it should help. Also, try adding this to
 the top of your script:
 
 echo 'test';
 
 If you still get a blank page, then it's probably not a problem with your
 actual script. Maybe your configuration.
 
 Tony
 

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



[PHP-DB] RE : Re: [PHP-DB]: small question php/postgreSQL

2006-11-07 Thread Desmond Coughlan
X-No-Archive:
  
Curious.  I put this in a file... 
   
  ?php
  echo 'pHello World/p'
  ?

  Bingo.  
   
  I then take the *same* file, I don't rename it, I just open it in vi.  I copy 
a single occurrence of 'pg_connect' etc... 
   
  And the 'hello world' disappears.  
   
  D.
  

Tony Grimes [EMAIL PROTECTED] a écrit :
  Is your server configured to display errors? Try adding this at the top of
your script:

ini_set('display_errors',true);

It won't catch syntax errors, but it should help. Also, try adding this to
the top of your script:

echo 'test';

If you still get a blank page, then it's probably not a problem with your
actual script. Maybe your configuration.

Tony


On 11/7/06 8:38 AM, Desmond Coughlan wrote:

 X-No-Archive: true
 
 That doesn't work, either. Still the blank page. Hmm ... the file is in the
 right place../usr/local/www/data ... 'cos all of the other files (*.html one
 an d all) are served from there, and they're available to the outside world.
 
 D.
 
 Bastien Koert a écrit :
 The code does need to know what the fields are...I think a more likely issue
 is the query for some reason, also change the $query to result in the query
 statement
 
 try
 
 $result=pg_query($query) or die(pg_error()); //to see if there are any
 errors with the query
 
 while($row=pg_fetch_array($result,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }else{
 echo No rows found;
 }
 
 
 bastien
 
 
 From: JeRRy 
 To: php-db@lists.php.net
 Subject: [PHP-DB] re: small question php/postgreSQL (basic question, not
 small)
 Date: Tue, 7 Nov 2006 23:18:58 +1100 (EST)
 
 Date: Tue, 7 Nov 2006 10:38:18 +0100 (CET) From: Desmond
 Coughlan To: php
 
 Subject: small question php/postgreSQL
 Hi,
 
 I've been trying to get a small DB up and working with PhP. It's a
 library, and so far, I can't get past the stage of displaying a page. I
 try the 'hello world' example, and it displays. I then populate a DB
 and can access it via psql ..
 
 cdi= SELECT * FROM stock ;
 -[ RECORD 1 ]-+---
 stock_ids | 1
 isbn_no | 10101010
 code_livre | 23455
 titre | toto goes to Hollywood
 editeur | editions toto
 collection | collection toto
 auteur_nom | smith
 auteur_prenom | john
 matiere | ang
 media_type | li
 -[ RECORD 2 ]-+---
 stock_ids | 2
 isbn_no | 10536278
 code_livre | 24874
 titre | toto comes back from Hollywood
 editeur | editions baba
 collection | collection toto
 auteur_nom | martin
 auteur_prenom | peter
 matiere | fre
 media_type | dvd
 
 OK, I then write the following script 
 
 pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
 Connect: .pg
 _last_error());
 $query=SELECT * FROM stock;
 $query=pg_query($query);
 // start the output
 while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }
 ?
 
 (sorry not to put that in italics or whatever...)
 
 ... and put it in the document root of my webserver, under
 php_experimental.
 
 I get a blank page. The apache weblogs look like ...
 
 192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET
 /php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible;
 MSIE 6.0;
 Windows NT 5.0)
 
 There's something obvious that I'm missing. Any ideas ..?
 
 Thanks.
 
 D.
 
 --
 
 re:
 
 pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
 Connect: .pg
 _last_error());
 $query=SELECT * FROM stock;
 $query=pg_query($query);
 // start the output
 while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }
 ?
 
 Simple, isbn_no and code_livre need to be defined in your code.
 Otherwise PHP don't know what your looking for.
 
 There is PLENTY of docs online to show you how to display items in a DB.
 Hello World is basic, too basic to use as an example and is a poor one to
 use. If your nerw you have to go a bit more into it than Hello World code.
 (which in my opinion gets you know-where) been there done that.
 
 Google how to display items in a DB in PHP and shoot you get some handy
 things.
 
 I just feel this question is not required here when google has all the
 answers like this.
 
 Jerry
 
 _
 Ready for the world's first international mobile film festival celebrating
 the creative potential of today's youth? Check out Mobile Jam Fest for your
 a chance to WIN $10,000! www.mobilejamfest.com

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




-
 Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses.

Re: [PHP-DB]: small question php/postgreSQL

2006-11-07 Thread Tony Grimes
You should turn on display_errors in your php.ini file. That would make it a
lot easier to track down the error.

Tony


On 11/7/06 9:27 AM, Desmond Coughlan [EMAIL PROTECTED] wrote:

 X-No-Archive:
   
 
 Curious.  I put this in a file...
   
  
   
 ?php
   
 echo 'pHello World/p'
   
 ?
   
 Bingo.  
   
  
   
 I then take the *same* file, I don't rename it, I just open it in vi.  I copy
 a single occurrence of 'pg_connect' etc...
   
  
   
 And the 'hello world' disappears.
   
  
   
 D.
   
 
 
 Tony Grimes [EMAIL PROTECTED] a écrit :
   
 Is your server configured to display errors? Try adding this at the top of
 your script:
 
 ini_set('display_errors',true);
 
 It won't catch syntax errors, but it should help. Also, try adding this to
 the top of your script:
 
 echo 'test';
 
 If you still get a blank page, then it's  probably not a problem with your
 actual script. Maybe your configuration.
 
 Tony
 
 
 On 11/7/06 8:38 AM, Desmond Coughlan wrote:
 
  X-No-Archive: true
  
  That doesn't work, either. Still the blank page. Hmm ... the file is in
 the
  right place../usr/local/www/data ... 'cos all of the other files (*.html
 one
  an d all) are served from there, and they're available to the outside
 world.
  
  D.
  
  Bastien Koert a écrit :
  The code does need to know what the fields are...I think a more likely
 issue
  is the query for some reason, also change the $query to result in the
 query
  statement
  
  try
  
  $result=pg_query($query) or die(pg_error()); //to see if there are any
  errors with the query
  
  while($row=pg_fetch_array($result,NULL,PGSQL_ASSOC)) {
  echo Title:  .$row['isbn_no'].
  ;
  echo blah .$row['code_livre'].
  ;
  }else{
  echo No rows found;
  }
  
  
  bastien
  
  
  From: JeRRy
  To: php-db@lists.php.net
  Subject: [PHP-DB] re: small question php/postgreSQL (basic question, not
  small)
  Date: Tue, 7 Nov 2006 23:18:58 +1100 (EST)
  
  Date: Tue, 7 Nov 2006 10:38:18 +0100 (CET) From: Desmond
  Coughlan To: php
  
  Subject: small question php/postgreSQL
  Hi,
  
  I've been trying to get a small DB up and working with PhP. It's a
  library, and so far, I can't get past the stage of displaying a page. I
  try the 'hello world' example, and it displays. I then populate a DB
  and can access it via psql ..
  
  cdi= SELECT * FROM stock ;
  -[ RECORD 1  ]-+---
  stock_ids | 1
  isbn_no | 10101010
  code_livre | 23455
  titre | toto goes to Hollywood
  editeur | editions toto
  collection | collection toto
  auteur_nom | smith
  auteur_prenom | john
  matiere | ang
  media_type | li
  -[ RECORD 2 ]-+---
  stock_ids | 2
  isbn_no | 10536278
  code_livre | 24874
  titre | toto comes back from Hollywood
  editeur | editions baba
  collection | collection toto
  auteur_nom | martin
  auteur_prenom | peter
  matiere | fre
  media_type | dvd
  
  OK, I then write the following script 
  
  pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
  Connect: .pg
  _last_error());
   $query=SELECT * FROM stock;
  $query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
  echo Title: .$row['isbn_no'].
  ;
  echo blah .$row['code_livre'].
  ;
  }
  ?
  
  (sorry not to put that in italics or whatever...)
  
  ... and put it in the document root of my webserver, under
  php_experimental.
  
  I get a blank page. The apache weblogs look like ...
  
  192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET
  /php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible;
  MSIE 6.0;
  Windows NT 5.0)
  
  There's something obvious that I'm missing. Any ideas ..?
  
  Thanks.
  
  D.
  
  --
   
  re:
  
  pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
  Connect: .pg
  _last_error());
  $query=SELECT * FROM stock;
  $query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
  echo Title: .$row['isbn_no'].
  ;
  echo blah .$row['code_livre'].
  ;
  }
  ?
  
  Simple, isbn_no and code_livre need to be defined in your code.
  Otherwise PHP don't know what your looking for.
  
  There is PLENTY of docs online to show you how to display items in a DB.
  Hello World is basic, too basic to use as an example and is a poor one
to
  use. If your nerw you have to go a bit more into it than Hello World
 code.
  (which in my opinion gets you know-where) been there done  that.
  
  Google how to display items in a DB in PHP and shoot you get some handy
  things.
  
  I just feel this question is not required here when google has all the
  answers like this.
  
  Jerry
  
  _
  Ready for the world's first international mobile film festival celebrating
  the creative potential of today's youth? Check out Mobile Jam Fest for
 your
  a chance to WIN $10,000! www.mobilejamfest.com
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, 

[PHP-DB] Consistent crash using PHP 5.1.4 SQLite 3.2.8 (PDO)

2006-11-07 Thread Avram Lyon

I get a crash on execution of any sqlite query (PDO). I think that
pretty much everything I know about the problem is described in detail
below, and I'm hoping someone can tell me that this is a known bug,
and that it's been fixed already.

These are the versions of Apache and SQLite that ship with Mac OS X
10.4.x, for what it's worth.

Thanks in advance for any and all help.

- Avram Lyon

Expected Behavior:
With the PHP code and SQLite database described below, I expect the
following result, which I get from the CLI version of PHP:

$ cat BasicTest.php | php
Array
(
   [COUNT(*)] = 1
   [0] = 1
)

When I load request the page BasicTest.php (below) from the webserver,
using any user agent I've tried (Firefox, Safari, curl, wget, Internet
Explorer, lynx), half the time I get no response:

$ curl http://localhost/~lyonavra/yellowtail/BasicTest.php
curl: (52) Empty reply from server

The other half of the time, I get the correct response:

$ curl http://localhost/~lyonavra/yellowtail/BasicTest.php
Array
(
   [COUNT(*)] = 1
   [0] = 1
)

When I get no response from the server, it's because an instance of
httpd crashed, and the crash report information is provided below. The
crash information is identical, regardless of the query.

When I use the CLI version of PHP, I can repeat the call as often as I
like, and it'll run correctly every time. Via Apache, every other
request fails, even if the requests are spaced out as much as a minute
apart (I haven't tried longer apart, but it really doesn't seem to
have to do with the time separation).


Reduced case PHP code (BasicTest.php):
?php
$db = new PDO(sqlite:/Library/WebServer/Databases/yellowtail.sqlite);
$sth = $db-prepare(SELECT COUNT(*) FROM users);
$sth-execute();
print_r($sth-fetch());
?

Output from sqlite3:
sqlite .dump
BEGIN TRANSACTION;
CREATE TABLE users (id INTEGER PRIMARY KEY, username VARCHAR(70),
password VARCHAR(70), created DATETIME, last_login DATETIME, UNIQUE
(username));
INSERT INTO users VALUES(1, 'ajlyon',
'b7a875fc1ea228b9061041b7cec4bd3c52ab3ce3', '2006-11-06 00:29:39',
NULL);
COMMIT;
sqlite SELECT COUNT(*) FROM users;
1
sqlite SELECT * FROM users;
1|ajlyon|b7a875fc1ea228b9061041b7cec4bd3c52ab3ce3|2006-11-06 00:29:39|


Line in /var/log/httpd/error_log:
[Mon Nov  6 22:33:55 2006] [notice] child pid 17792 exit signal Bus error (10)

Crash report follows (httpd.crash.log, from CrashReporter)
--
Host Name:  avram
Date/Time:  2006-11-06 22:33:52.542 +0300
OS Version: 10.4.7 (Build 8J135)
Report Version: 4

Command: httpd
Path:/usr/sbin/httpd
Parent:  httpd [14555]

Version: ??? (???)

PID:17792
Thread: 0

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:  KERN_PROTECTION_FAILURE (0x0002) at 0x

Thread 0 Crashed:
0   libphp5.so  0x0218f8cc shutdown_memory_manager + 116 (zend_alloc.c:511)
1   libphp5.so  0x02168f44 php_request_shutdown + 928 (main.c:1307)
2   libphp5.so  0x02227438 apache_php_module_main + 252 (sapi_apache.c:60)
3   libphp5.so  0x02228130 send_php + 1096 (mod_php5.c:493)
4   httpd   0xdd18 ap_invoke_handler + 232
5   httpd   0x00017dd4 process_request_internal + 640
6   httpd   0x00017e54 ap_process_request + 72
7   httpd   0x6b60 child_main + 1832
8   httpd   0x6dc4 make_child + 312
9   httpd   0x70f4 perform_idle_server_maintenance + 572
10  httpd   0x76d0 standalone_main + 964
11  httpd   0x7d74 main + 1052
12  httpd   0x238c _start + 348
13  httpd   0x222c start + 60

Thread 0 crashed with PPC Thread State 64:
 srr0: 0x0218f8cc srr1: 0x0200f030
   vrsave: 0x
   cr: 0x24000444  xer: 0x0002   lr:
0x0218f8e8  ctr: 0x0001
   r0: 0x003eb580   r1: 0xbfffe510   r2:
0x   r3: 0x003ed6b0
   r4: 0x003ebd60   r5: 0x02168f0c   r6:
0x022db384   r7: 0x00ff
   r8: 0x0001   r9: 0xa0001fac  r10:
0x0001  r11: 0x44000442
  r12: 0x900067ac  r13: 0x  r14:
0x  r15: 0x
  r16: 0x  r17: 0x  r18:
0x  r19: 0x
  r20: 0x  r21: 0x  r22:
0x  r23: 0x00056ec0
  r24: 0x  r25: 0x022de084  r26:
0x0008  r27: 0x022de080
  r28: 0x0300  r29: 0x022e0c90  r30:
0x0001  r31: 0x0218f860

Binary Images Description:
   0x1000 -0x4 httpd/usr/sbin/httpd
  0x65000 -0x67fff mod_log_config.so
/usr/libexec/httpd/mod_log_config.so
  0x6a000 -0x6bfff mod_mime.so  /usr/libexec/httpd/mod_mime.so
  0x6e000 -0x72fff mod_negotiation.so
/usr/libexec/httpd/mod_negotiation.so
  0x75000 -0x7afff mod_include.so   /usr/libexec/httpd/mod_include.so
  0x7e000 -0x82fff mod_autoindex.so 

RE: [PHP-DB] RE : RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)

2006-11-07 Thread Dwight Altman
You have
while($row=pg_fetch_array($result,NULL,PGSQL_ASSOC)) {
What's with the NULL ?
row

Row number in result to fetch. Rows are numbered from 0 upwards. If
omitted, next row is fetched.
BUT you are requesting the NULL row?

Why not just use
while($row=pg_fetch_assoc($result)) {



Regards,
Dwight

 -Original Message-
 From: Desmond Coughlan [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, November 07, 2006 9:38 AM
 To: Bastien Koert; [EMAIL PROTECTED]; php-db@lists.php.net
 Subject: [PHP-DB] RE : RE: [PHP-DB] re: small question php/postgreSQL
 (basic question, not small)
 
 X-No-Archive: true
 
   That doesn't work, either.  Still the blank page.  Hmm ... the file is
 in the right place../usr/local/www/data ... 'cos all of the other files
 (*.html one an d all) are served from there, and they're available to the
 outside world.
 
   D.
 
 Bastien Koert [EMAIL PROTECTED] a écrit :
   The code does need to know what the fields are...I think a more likely
 issue
 is the query for some reason, also change the $query to result in the
 query
 statement
 
 try
 
 $result=pg_query($query) or die(pg_error()); //to see if there are any
 errors with the query
 
 while($row=pg_fetch_array($result,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }else{
 echo No rows found;
 }
 
 
 bastien
 
 
 From: JeRRy
 To: php-db@lists.php.net
 Subject: [PHP-DB] re: small question php/postgreSQL (basic question, not
 small)
 Date: Tue, 7 Nov 2006 23:18:58 +1100 (EST)
 
  Date: Tue, 7 Nov 2006 10:38:18 +0100 (CET) From: Desmond
 Coughlan To: php
 
  Subject: small question php/postgreSQL
  Hi,
 
  I've been trying to get a small DB up and working with PhP. It's a
 library, and so far, I can't get past the stage of displaying a page. I
 try the 'hello world' example, and it displays. I then populate a DB
 and can access it via psql ..
 
  cdi= SELECT * FROM stock ;
 -[ RECORD 1 ]-+---
 stock_ids | 1
 isbn_no | 10101010
 code_livre | 23455
 titre | toto goes to Hollywood
 editeur | editions toto
 collection | collection toto
 auteur_nom | smith
 auteur_prenom | john
 matiere | ang
 media_type | li
 -[ RECORD 2 ]-+---
 stock_ids | 2
 isbn_no | 10536278
 code_livre | 24874
 titre | toto comes back from Hollywood
 editeur | editions baba
 collection | collection toto
 auteur_nom | martin
 auteur_prenom | peter
 matiere | fre
 media_type | dvd
 
  OK, I then write the following script 
 
   pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
 Connect: .pg
 _last_error());
 $query=SELECT * FROM stock;
 $query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }
  ?
 
  (sorry not to put that in italics or whatever...)
 
  ... and put it in the document root of my webserver, under
 php_experimental.
 
  I get a blank page. The apache weblogs look like ...
 
  192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET
 /php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible;
 MSIE 6.0;
 Windows NT 5.0)
 
  There's something obvious that I'm missing. Any ideas ..?
 
 Thanks.
 
 D.
 
 --
 
  re:
 
   pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
 Connect: .pg
 _last_error());
 $query=SELECT * FROM stock;
 $query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
 ;
 echo blah .$row['code_livre'].
 ;
 }
  ?
 
  Simple, isbn_no and code_livre need to be defined in your code.
 Otherwise PHP don't know what your looking for.
 
  There is PLENTY of docs online to show you how to display items in a DB.
  Hello World is basic, too basic to use as an example and is a poor one
 to
 use. If your nerw you have to go a bit more into it than Hello World
 code.
  (which in my opinion gets you know-where) been there done that.
 
  Google how to display items in a DB in PHP and shoot you get some handy
 things.
 
  I just feel this question is not required here when google has all the
 answers like this.
 
  Jerry
 
 _
 Ready for the world's first international mobile film festival celebrating
 the creative potential of today's youth? Check out Mobile Jam Fest for
 your
 a chance to WIN $10,000! www.mobilejamfest.com
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 -
  Découvrez une nouvelle façon d'obtenir des réponses à toutes vos
 questions ! Profitez des connaissances, des opinions et des expériences
 des internautes sur Yahoo! Questions/Réponses.

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



[PHP-DB] RE: What's the PHP equivallent of mysql mydb somefile.sql

2006-11-07 Thread Frank M Flynn
You can put any valid SQL command into the mysql_query command so you
could write a PHP file that had a bunch of lines like these (after your
connect and such)

 mysql_query ( ALTER TABLE foo ADD COLUMN bar int... );
 mysql_query ( CREATE TABLE foo2 (foo2ID int) );

Better still to check that these changes have not been made already first
and then to check for errors after each command and do something
intelligent (like print an error message for example).  Try this

 mysql_query ( SELECT bar FROM foo) or mysql_query ( ALTER TABLE
foo ADD COLUMN bar int... );

at minimum or expand the above to set some variables to say what it found
done already, what was missing and what it tried to create and the results
from that.  Suppose the mysql user does not have CREATE TABLE
permissions - if you printed the mysql_error () you'd see this problem
instantly - saving you many hours of debug time.

One last thought - if you have a standard LAMP application and your using
one mysql user to do all of this you might want to think about it.  You
typically do not want the mysql user to have CREATE TABLE permissions
and such.  You also don't want to hard code a user and password into the
application upgrade script (a evildoer might find these and use this
account to break in).  So you might want this PHP page to ask for a user
name and PW that has these permissions - avoid hard coding this to root,
perhaps there is another account the sys admin wants to use.

Good luck,
Frank

On Oct 10, 2006, at 7:39 AM, [EMAIL PROTECTED] wrote:

From: Daevid Vincent [EMAIL PROTECTED]
Date: October 9, 2006 6:01:16 PM PDT
To: php-db@lists.php.net
Subject: What's the PHP equivallent of mysql mydb  somefile.sql


Currently I run an 'updater' script to run through a directory of .sql files
using something like this in PHP:

$COMMAND = mysql .$OPTION['db_prefix'].$db.  .$mydir.$filename;
system($COMMAND, $ret);

What would be the equivallent way to to this in a PHP mysql_query(); way?

I see LOAD, but that only works for data it seems.
http://dev.mysql.com/doc/refman/5.0/en/load-data.html

These scripts I use have ALTER statements and CREATE and all other types of
SQL in them and almost no data actually.

mySQL 5.0.15


ÐÆ5ÏÐ


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



[PHP-DB] Database abstract layer

2006-11-07 Thread Vignesh M P N
Hi

 

I am facing a common problem which any developer querying the database would
face.

 

In our web applications wherever we have more than one standard options for
a field, we usually denote them as integers. Say, for gender, we store it as
1 or 2, but we display that as male or female in the user interface. So far
I had been handling this translation in the presentation layer ie., just
before displaying the data in the table, I check if the retrieved is 1 and
then translate it to male and so on. But this becomes clumsy when we have
lots of such standard options and when we need this translation in multiple
places in the application.

 

So now I am thinking of adding an abstract layer which does all the
querying, retrieving and translation; and then return to my presentation
layer, so that if my presentation layer just calls a function in the
database abstract layer with the required query parameters, it gets back a
resultset with the translations. I hope this is a very common problem every
developer faces.

 

I would like to have your guidance on this. I understand that a resultset
object is not easy to replicate. How do I make these translations and store
them back in an object and return it to the presentation layer? 

 

Or do we have existing PHP libraries which serve this purpose? Could you
suggest me a better way of solving this problem?

 

Please help me on this.

 

Thanks

Vignesh.

 

 



Re: [PHP-DB] Database abstract layer

2006-11-07 Thread Tony Grimes
Why not build the options into your data model? Instead of using integers
for gender, use a varchar field that stores 'Male' and 'Female'. You can
ensure data integrity by adding a check constraint to the column.

If the presentation might change depending on context, you can create gender
reference table with columns like short_name, long_name and abbreviation and
use a foreign key to reference it from the main table.

I try to use natural keys (i.e. Male,Female) instead of surrogate keys (1,2)
whenever possible. It makes the database information more readable and
you're not constantly picking through code to figure out what '3' means.

Hope that helps,
Tony


On 11/7/06 2:19 PM, Vignesh M P N [EMAIL PROTECTED] wrote:

 Hi
 
 
 
 I am facing a common problem which any developer querying the database would
 face.
 
 
 
 In our web applications wherever we have more than one standard options for
 a field, we usually denote them as integers. Say, for gender, we store it as
 1 or 2, but we display that as male or female in the user interface. So far
 I had been handling this translation in the presentation layer ie., just
 before displaying the data in the table, I check if the retrieved is 1 and
 then translate it to male and so on. But this becomes clumsy when we have
 lots of such standard options and when we need this translation in multiple
 places in the application.
 
 
 
 So now I am thinking of adding an abstract layer which does all the
 querying, retrieving and translation; and then return to my presentation
 layer, so that if my presentation layer just calls a function in the
 database abstract layer with the required query parameters, it gets back a
 resultset with the translations. I hope this is a very common problem every
 developer faces.
 
 
 
 I would like to have your guidance on this. I understand that a resultset
 object is not easy to replicate. How do I make these translations and store
 them back in an object and return it to the presentation layer?
 
 
 
 Or do we have existing PHP libraries which serve this purpose? Could you
 suggest me a better way of solving this problem?
 
 
 
 Please help me on this.
 
 
 
 Thanks
 
 Vignesh.
 
 
 
 
 
 

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



Re: [PHP-DB] Database abstract layer

2006-11-07 Thread Natalie Leotta

We have 0/1/2 for gender but also have tlkpSex or something like that.  It
has the id and the string we want to use, then our queries just make sure
that data.gender=tlkpSex.gender.

Good luck!

Natalie

On 11/7/06, Tony Grimes [EMAIL PROTECTED] wrote:


Why not build the options into your data model? Instead of using integers
for gender, use a varchar field that stores 'Male' and 'Female'. You can
ensure data integrity by adding a check constraint to the column.

If the presentation might change depending on context, you can create
gender
reference table with columns like short_name, long_name and abbreviation
and
use a foreign key to reference it from the main table.

I try to use natural keys (i.e. Male,Female) instead of surrogate keys
(1,2)
whenever possible. It makes the database information more readable and
you're not constantly picking through code to figure out what '3' means.

Hope that helps,
Tony


On 11/7/06 2:19 PM, Vignesh M P N [EMAIL PROTECTED] wrote:

 Hi



 I am facing a common problem which any developer querying the database
would
 face.



 In our web applications wherever we have more than one standard options
for
 a field, we usually denote them as integers. Say, for gender, we store
it as
 1 or 2, but we display that as male or female in the user interface. So
far
 I had been handling this translation in the presentation layer ie., just
 before displaying the data in the table, I check if the retrieved is 1
and
 then translate it to male and so on. But this becomes clumsy when we
have
 lots of such standard options and when we need this translation in
multiple
 places in the application.



 So now I am thinking of adding an abstract layer which does all the
 querying, retrieving and translation; and then return to my presentation
 layer, so that if my presentation layer just calls a function in the
 database abstract layer with the required query parameters, it gets back
a
 resultset with the translations. I hope this is a very common problem
every
 developer faces.



 I would like to have your guidance on this. I understand that a
resultset
 object is not easy to replicate. How do I make these translations and
store
 them back in an object and return it to the presentation layer?



 Or do we have existing PHP libraries which serve this purpose? Could you
 suggest me a better way of solving this problem?



 Please help me on this.



 Thanks

 Vignesh.







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




RE: [PHP-DB] Database abstract layer

2006-11-07 Thread Bastien Koert
WE use XML here to store the values, however our requirements also add the 
ability to use mutiple languages so its a little more complex.


For personal projects I store the various data like this into a 
system_option table as text (1,Male;2,Female;) and then have a common 
routine that grabs the required bits of info from this table and passes it 
thru a framework when creating the appropriate html. The framework is a 
series fucntions that get passed the various bits of data (like what the 
field type is (date, text, radio etc), the value from the db, the 
system_option value for that element and combines it all into an html 
snippet that is then shown to the user.


Bastien



From: Vignesh M P N [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Database abstract layer
Date: Tue, 07 Nov 2006 15:19:26 -0600

Hi



I am facing a common problem which any developer querying the database 
would

face.



In our web applications wherever we have more than one standard options for
a field, we usually denote them as integers. Say, for gender, we store it 
as

1 or 2, but we display that as male or female in the user interface. So far
I had been handling this translation in the presentation layer ie., just
before displaying the data in the table, I check if the retrieved is 1 
and

then translate it to male and so on. But this becomes clumsy when we have
lots of such standard options and when we need this translation in multiple
places in the application.



So now I am thinking of adding an abstract layer which does all the
querying, retrieving and translation; and then return to my presentation
layer, so that if my presentation layer just calls a function in the
database abstract layer with the required query parameters, it gets back a
resultset with the translations. I hope this is a very common problem every
developer faces.



I would like to have your guidance on this. I understand that a resultset
object is not easy to replicate. How do I make these translations and store
them back in an object and return it to the presentation layer?



Or do we have existing PHP libraries which serve this purpose? Could you
suggest me a better way of solving this problem?



Please help me on this.



Thanks

Vignesh.







_
Buy, Load, Play. The new Sympatico / MSN Music Store works seamlessly with 
Windows Media Player. Just Click PLAY. 
http://musicstore.sympatico.msn.ca/content/viewer.aspx?cid=SMS_Sept192006


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



Re: [PHP-DB] small question php/postgreSQL

2006-11-07 Thread Chris

Desmond Coughlan wrote:

X-No-Archve: true
   
  Hi,
   
  I've been trying to get a small DB up and working with PhP.  It's a library, and so far, I can't get past the stage of displaying a page.  I try the 'hello world' example, and it displays.  I then populate a DB and can access it via psql .. 
   
  cdi= SELECT * FROM stock ;

-[ RECORD 1 ]-+---
stock_ids | 1
isbn_no   | 10101010
code_livre| 23455
titre | toto goes to Hollywood
editeur   | editions toto
collection| collection toto
auteur_nom| smith
auteur_prenom | john
matiere   | ang
media_type| li
-[ RECORD 2 ]-+---
stock_ids | 2
isbn_no   | 10536278
code_livre| 24874
titre | toto comes back from Hollywood
editeur   | editions baba
collection| collection toto
auteur_nom| martin
auteur_prenom | peter
matiere   | fre
media_type| dvd

  OK, I then write the following script  
   
  ?php

  pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't Connect: 
.pg
_last_error());


If that doesn't work - then you don't have the php-postgres library 
installed.


Check your phpinfo page for postgresql - if it's not there, then 
that's your problem.


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] RE : RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)

2006-11-07 Thread JeRRy
phpinfo can be a little bit of info that may have a module missing.  But I 
doubt that is the issue here, but you never know.  Why don't be just change 
your query completely like you would in SQL if you were searching direct for 
certain fields?  Because if these 2 fields are the only fields you will EVER 
need in this page why be too technical.  However if your thinking of adding the 
other fields than this is trhe way to go.

I have probably missed something along the traps.  But I am happy to try and 
demonstrate another way you could do it.

Are you on your own server or sub-leased or something?

Jerry


- Original Message 
From: Bastien Koert [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; php-db@lists.php.net
Sent: Wednesday, 8 November, 2006 2:45:49 AM
Subject: RE: [PHP-DB] RE : RE: [PHP-DB] re: small question php/postgreSQL 
(basic question, not small)


is your server set to work with php files?

Bastien


From: Desmond Coughlan [EMAIL PROTECTED]
To: Bastien Koert [EMAIL PROTECTED], [EMAIL PROTECTED],  
php-db@lists.php.net
Subject: [PHP-DB] RE : RE: [PHP-DB] re: small question php/postgreSQL 
(basic question, not small)
Date: Tue, 7 Nov 2006 16:38:24 +0100 (CET)

X-No-Archive: true

   That doesn't work, either.  Still the blank page.  Hmm ... the file is 
in the right place../usr/local/www/data ... 'cos all of the other files 
(*.html one an d all) are served from there, and they're available to the 
outside world.

   D.

Bastien Koert [EMAIL PROTECTED] a écrit :
   The code does need to know what the fields are...I think a more likely 
issue
is the query for some reason, also change the $query to result in the query
statement

try

$result=pg_query($query) or die(pg_error()); //to see if there are any
errors with the query

while($row=pg_fetch_array($result,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].
;
echo blah .$row['code_livre'].
;
}else{
echo No rows found;
}


bastien


 From: JeRRy
 To: php-db@lists.php.net
 Subject: [PHP-DB] re: small question php/postgreSQL (basic question, not
 small)
 Date: Tue, 7 Nov 2006 23:18:58 +1100 (EST)
 
  Date: Tue, 7 Nov 2006 10:38:18 +0100 (CET) From: Desmond
 Coughlan To: php

  Subject: small question php/postgreSQL
  Hi,
 
  I've been trying to get a small DB up and working with PhP. It's a
 library, and so far, I can't get past the stage of displaying a page. I
 try the 'hello world' example, and it displays. I then populate a DB
 and can access it via psql ..
 
  cdi= SELECT * FROM stock ;
 -[ RECORD 1 ]-+---
 stock_ids | 1
 isbn_no | 10101010
 code_livre | 23455
 titre | toto goes to Hollywood
 editeur | editions toto
 collection | collection toto
 auteur_nom | smith
 auteur_prenom | john
 matiere | ang
 media_type | li
 -[ RECORD 2 ]-+---
 stock_ids | 2
 isbn_no | 10536278
 code_livre | 24874
 titre | toto comes back from Hollywood
 editeur | editions baba
 collection | collection toto
 auteur_nom | martin
 auteur_prenom | peter
 matiere | fre
 media_type | dvd
 
  OK, I then write the following script 
 
   pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
 Connect: .pg
 _last_error());
 $query=SELECT * FROM stock;
 $query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
;
 echo blah .$row['code_livre'].
;
 }
  ?
 
  (sorry not to put that in italics or whatever...)
 
  ... and put it in the document root of my webserver, under
 php_experimental.
 
  I get a blank page. The apache weblogs look like ...
 
  192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET
 /php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible;
 MSIE 6.0;
 Windows NT 5.0)
 
  There's something obvious that I'm missing. Any ideas ..?
 
 Thanks.
 
 D.
 
 --
 
  re:
 
   pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
 Connect: .pg
 _last_error());
 $query=SELECT * FROM stock;
 $query=pg_query($query);
  // start the output
  while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
 echo Title: .$row['isbn_no'].
;
 echo blah .$row['code_livre'].
;
 }
  ?
 
  Simple, isbn_no and code_livre need to be defined in your code.
 Otherwise PHP don't know what your looking for.
 
  There is PLENTY of docs online to show you how to display items in a DB.
  Hello World is basic, too basic to use as an example and is a poor one 
to
 use. If your nerw you have to go a bit more into it than Hello World 
code.
  (which in my opinion gets you know-where) been there done that.
 
  Google how to display items in a DB in PHP and shoot you get some handy
 things.
 
  I just feel this question is not required here when google has all the
 answers like this.
 
  Jerry

_
Ready for the world's first international mobile film festival celebrating
the creative potential of today's youth? Check out Mobile Jam Fest for your
a chance to WIN 

[PHP-DB] Re: RE : RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)

2006-11-07 Thread JeRRy
Test:

- create a new account user
- go into the www directive
- create a index file
- do phpinfo()
- try and connect to a msql server, no query needed just a connection
- under that delibrately try and enter a mysq server but use a wrong pass, make 
sure you error report it with some message on screen.

if it connects and one fails your connections are fine.

However make sure you CLOSE each connection seperatley. 

What appears to be happening in your code it it's not going near the mysql 
server, it's skipping it.  Which means the die error will not appear if it 
skips it.

Ensure php is enabled and mysql is booted etc.

Also don't try and connect localhost to it, use the outside world.  (a browser 
- www.whatever.com or IP-ADDRESS)

J


- Original Message 
From: Desmond Coughlan [EMAIL PROTECTED]
To: Bastien Koert [EMAIL PROTECTED]; [EMAIL PROTECTED]; php-db@lists.php.net
Sent: Wednesday, 8 November, 2006 2:38:24 AM
Subject: RE : RE: [PHP-DB] re: small question php/postgreSQL (basic question, 
not small)


X-No-Archive: true
 
That doesn't work, either.  Still the blank page.  Hmm ... the file is in the 
right place../usr/local/www/data ... 'cos all of the other files (*.html one an 
d all) are served from there, and they're available to the outside world.
 
D.

Bastien Koert [EMAIL PROTECTED] a écrit :
The code does need to know what the fields are...I think a more likely issue 
is the query for some reason, also change the $query to result in the query 
statement

try

$result=pg_query($query) or die(pg_error()); //to see if there are any 
errors with the query

while($row=pg_fetch_array($result,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].
;
echo blah .$row['code_livre'].
;
}else{
echo No rows found;
}


bastien


From: JeRRy 
To: php-db@lists.php.net
Subject: [PHP-DB] re: small question php/postgreSQL (basic question, not 
small)
Date: Tue, 7 Nov 2006 23:18:58 +1100 (EST)

 Date: Tue, 7 Nov 2006 10:38:18 +0100 (CET) From: Desmond 
Coughlan To: php 
 Subject: small question php/postgreSQL
 Hi,

 I've been trying to get a small DB up and working with PhP. It's a
library, and so far, I can't get past the stage of displaying a page. I
try the 'hello world' example, and it displays. I then populate a DB
and can access it via psql ..

 cdi= SELECT * FROM stock ;
-[ RECORD 1 ]-+---
stock_ids | 1
isbn_no | 10101010
code_livre | 23455
titre | toto goes to Hollywood
editeur | editions toto
collection | collection toto
auteur_nom | smith
auteur_prenom | john
matiere | ang
media_type | li
-[ RECORD 2 ]-+---
stock_ids | 2
isbn_no | 10536278
code_livre | 24874
titre | toto comes back from Hollywood
editeur | editions baba
collection | collection toto
auteur_nom | martin
auteur_prenom | peter
matiere | fre
media_type | dvd

 OK, I then write the following script 

 
 pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
Connect: .pg
_last_error());
$query=SELECT * FROM stock;
$query=pg_query($query);
 // start the output
 while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].
;
echo blah .$row['code_livre'].
;
}
 ?

 (sorry not to put that in italics or whatever...)

 ... and put it in the document root of my webserver, under
php_experimental.

 I get a blank page. The apache weblogs look like ...

 192.168.0.254 - - [07/Nov/2006:10:37:30 +0100] GET
/php_experimental/base.php HTTP/1.1 200 - - Mozilla/4.0 (compatible; 
MSIE 6.0;
Windows NT 5.0)

 There's something obvious that I'm missing. Any ideas ..?

Thanks.

D.

--

 re:

 
 pg_connect (dbname=cdi user=cdi password=toto) or die (Couldn't
Connect: .pg
_last_error());
$query=SELECT * FROM stock;
$query=pg_query($query);
 // start the output
 while($row=pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
echo Title: .$row['isbn_no'].
;
echo blah .$row['code_livre'].
;
}
 ?

 Simple, isbn_no and code_livre need to be defined in your code. 
Otherwise PHP don't know what your looking for.

 There is PLENTY of docs online to show you how to display items in a DB. 
 Hello World is basic, too basic to use as an example and is a poor one to 
use. If your nerw you have to go a bit more into it than Hello World code. 
 (which in my opinion gets you know-where) been there done that.

 Google how to display items in a DB in PHP and shoot you get some handy 
things.

 I just feel this question is not required here when google has all the 
answers like this.

 Jerry

_
Ready for the world's first international mobile film festival celebrating 
the creative potential of today's youth? Check out Mobile Jam Fest for your 
a chance to WIN $10,000! www.mobilejamfest.com

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






Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des 

Re: [PHP-DB] Re: RE : RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)

2006-11-07 Thread Chris

JeRRy wrote:

Test:

- create a new account user
- go into the www directive
- create a index file
- do phpinfo()
- try and connect to a msql server, no query needed just a connection
- under that delibrately try and enter a mysq server but use a wrong pass, make 
sure you error report it with some message on screen.

if it connects and one fails your connections are fine.

However make sure you CLOSE each connection seperatley. 


What appears to be happening in your code it it's not going near the mysql 
server, it's skipping it.  Which means the die error will not appear if it 
skips it.

Ensure php is enabled and mysql is booted etc.

Also don't try and connect localhost to it, use the outside world.  (a browser 
- www.whatever.com or IP-ADDRESS)


Err - the OP is having an issue with postgresql, not mysql. The subject 
even mentions this..


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Re: RE : RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)

2006-11-07 Thread JeRRy
True, sorry! (missed that, haha wake up!)


- Original Message 
From: Chris [EMAIL PROTECTED]
To: JeRRy [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Sent: Wednesday, 8 November, 2006 3:14:01 PM
Subject: Re: [PHP-DB] Re: RE : RE: [PHP-DB] re: small question php/postgreSQL 
(basic question, not small)


JeRRy wrote:
 Test:
 
 - create a new account user
 - go into the www directive
 - create a index file
 - do phpinfo()
 - try and connect to a msql server, no query needed just a connection
 - under that delibrately try and enter a mysq server but use a wrong pass, 
 make sure you error report it with some message on screen.
 
 if it connects and one fails your connections are fine.
 
 However make sure you CLOSE each connection seperatley. 
 
 What appears to be happening in your code it it's not going near the mysql 
 server, it's skipping it.  Which means the die error will not appear if it 
 skips it.
 
 Ensure php is enabled and mysql is booted etc.
 
 Also don't try and connect localhost to it, use the outside world.  (a 
 browser - www.whatever.com or IP-ADDRESS)

Err - the OP is having an issue with postgresql, not mysql. The subject 
even mentions this..

-- 
Postgresql  php tutorials
http://www.designmagick.com/