Hello,
I have a PHP program that contains a number of postgres queries. At
the end of the program, it needs to write data to a database. You can
see the code that I'm using below. I have die clauses on all the
queries and I have the program echoing the queries that it runs to the
screen. The die clause does not execute. The queries are echoed to
the screen, but nothing is being written to the database. There don't
appear to be any errors in the postgres log or the php log. Is there
a function that I can use that will tell me exactly what is going on
here? If there is, can you give me the syntax?
Thanks in advance for your time.
Carol
P.S. This PHP 5 and PostgreSQL 8.3.6 on Solaris 10.
+++
+++
I've written a query that needs to insert data into two base tables
and a bridge table. The code looks like...
/* Echo data for database to the screen
*/
echop Contact Locator: $cont_loc/p;
echop Contact Type Rank: $cont_rank/p;
echop Contact Info Type: $contact_type/p;
echop New name string: $f_name_new/p;
echop New name string: $m_name_new/p;
echop New name string: $l_name_new/p;
echop New ivl web string: $ivl_web_peop/p;
echop New cns_web string: $cns_web_peop/p;
echop New contact rank string: $cont_rank/p;
echop New contact locator string: $cont_loc/p;
echop New contact item string: $contact_info1/p;
echop New contact type string: $contact_type/p;
/* Connect to database
*/
include connect_km_tezt.php;
/* Run queries
*/
$query = INSERT INTO \tblPeople\(\fName\,\mName\,\lName\,
ivlweb, cnsweb)
VALUES ('$f_name_new', '$m_name_new','
$l_name_new', '$ivl_web_peop', '$cns_web_peop');
echo First query: . $query . br /;
$pg_peop_ins = pg_query($query) or die(Can't execute first
query);
// echo pg_last_error(Last Error .
$pg_peop_ins);
//echo pg_result_error($pg_peop_ins);
$query = INSERT INTO \tblContactInformation\(\contactItem\,
\contactType\)
VALUES
('$contact_info1','$contact_type');
echo Second query: . $query . br /;
$pg_contact_ins = pg_query($query) or die(Can't execute 2nd
query);
$query = INSERT INTO \brdgPeopleContactInformation\
(\peopleId\,\contactInformationId\,rank,
type)
VALUES (currval('\tblPeople_peopleId_seq
\'),currval('\tblContactInformation_contactInformationId_seq\'),
'$cont_rank', '$cont_loc');
echo Third query: . $query . br /;
$pg_peop_cont_ins = pg_query($query) or die(Can't execute 3rd
query);
+++
++
The postgres log looks like this ...
[km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]STATEMENT: INSERT INTO
tblPeople(fName,mName,lName, ivlweb, cnsweb)
VALUES ('Frank',
'D',' Oz', 't', 't')
[km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]LOG: duration: 105.005 ms
[km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]LOG: PLANNER STATISTICS
[km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]DETAIL: ! system usage
stats:
! 0.51 elapsed 0.50 user 0.06 system sec
! [0.064533 user 0.013546 sys total]
! 0/2 [2976/197116] filesystem blocks in/out
! 0/0 [44325584/1] page faults/reclaims, 0 [465469248]
swaps
! 0 [0] signals rcvd, 1/3 [2/5] messages rcvd/sent
! 10/0 [-64186124/0] voluntary/involuntary context
switches
! buffer usage stats:
! Shared blocks: 0 read, 0 written,
buffer hit rate = 0.00%
! Local blocks: 0 read, 0 written,
buffer hit rate = 0.00%
! Direct blocks: 0 read, 0 written
[km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]STATEMENT: INSERT INTO
tblContactInformation(contactItem,contactType)
VALUES ('f...@indiana.edu
','0010')
[km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]LOG: duration: 10.856 ms
[km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]LOG: PLANNER STATISTICS
[km_app_admin:km_tezt:2009-05-08 10:34:49 EDT]DETAIL: ! system usage
stats:
! 0.28 elapsed 0.27 user 0.03 system sec
! [0.066803 user