Re: [PHP-DB] Re: RE : RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)
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/
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/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: RE : RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)
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 an
Re: [PHP-DB] RE : RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)
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: > > > > >
RE: [PHP-DB] RE : RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)
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. &g
[PHP-DB] RE : RE: [PHP-DB] RE : RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)
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 > >us
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 $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-5d7207d94d45&mkt=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: 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.
RE: [PHP-DB] re: small question php/postgreSQL (basic question, not small)
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 <[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" 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 "; 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: "; 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: small question php/postgreSQL (basic question, not small)
Date: Tue, 7 Nov 2006 10:38:18 +0100 (CET)From: "Desmond Coughlan" <[EMAIL PROTECTED]>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 "; 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: "; 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