[PHP-DB] Problem with pg_fetch_array
Hi
I am trying to display the rows from a database table in a grid.
I retrieved the results using pg_query() with a Select command. pg_query()
returns true.
But when I pass the results $rows to pg_fetch_array(), it returns false. I
even tried displaying the error, if any, using:
pg_fetch_array($rows) or die('fetch array failed: ' . pg_last_error());
I also tried pg_result_error(), but both didn't display error.
It just displays "fetch array failed: ", but it doesn't display any error.
When the pg_query() returns a result, I wonder why pg_fetch_array() is not
able to iterate through the rows.
I am new to this PHP database stuff, please help me in this.
Thanks
Vignesh.
[PHP-DB] Problem with Oracle
Hi, I have a problem with PHP and Oracle 10 Database. I read sql script from file and execute it. Files are something like this: insert into pts (pid, txt) values (1,'502a'); insert into pts (pid, txt) values (2,'502b'); . I receive a message: "ORA-00911: invalid character" When I remove manually the ";" from the end of every row and execute separate every command everything is ok. I have and script files fo creating procedures/functions and there in not a problem with ";". Where is the problem ? Why can not be used ";" as command separator from PHP ? Thanks in advance! Rosen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Problem with pg_fetch_array
show relevant code around the query and attempt to loop thru resultset bastien From: Vignesh M P N <[EMAIL PROTECTED]> To: [email protected] Subject: [PHP-DB] Problem with pg_fetch_array Date: Mon, 23 Oct 2006 15:12:25 -0500 Hi I am trying to display the rows from a database table in a grid. I retrieved the results using pg_query() with a Select command. pg_query() returns true. But when I pass the results $rows to pg_fetch_array(), it returns false. I even tried displaying the error, if any, using: pg_fetch_array($rows) or die('fetch array failed: ' . pg_last_error()); I also tried pg_result_error(), but both didn't display error. It just displays "fetch array failed: ", but it doesn't display any error. When the pg_query() returns a result, I wonder why pg_fetch_array() is not able to iterate through the rows. I am new to this PHP database stuff, please help me in this. Thanks Vignesh. _ 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
Re: [PHP-DB] Problem with pg_fetch_array
Vignesh M P N wrote:
Hi
I am trying to display the rows from a database table in a grid.
I retrieved the results using pg_query() with a Select command. pg_query()
returns true.
But when I pass the results $rows to pg_fetch_array(), it returns false. I
even tried displaying the error, if any, using:
You return $result to pg_fetch_array not $rows.
$query = "SELECT version()";
$result = pg_query($query);
while($row = pg_fetch_array($result)) {
print_r($row);
}
A shameless plug but: http://www.designmagick.com/article/10/
--
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] Problem with Oracle
Rosen wrote: Hi, I have a problem with PHP and Oracle 10 Database. I read sql script from file and execute it. Files are something like this: insert into pts (pid, txt) values (1,'502a'); insert into pts (pid, txt) values (2,'502b'); . I receive a message: "ORA-00911: invalid character" When I remove manually the ";" from the end of every row and execute separate every command everything is ok. I have and script files fo creating procedures/functions and there in not a problem with ";". Then you're not showing us the exact content of the files or the code you're using to make this insert into your database. What's the exact code you're using to go through the file and insert the data? -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
