Re: PHP Related Problem - Mailing list pgsql-general

From Nikola Milutinovic
Subject Re: PHP Related Problem
Date
Msg-id 005601c1471e$ebbe9010$0a3ea8c0@ev.co.yu
Whole thread Raw
In response to PHP Related Problem  (John Clark Naldoza y Lopez <njclark@ntsp.nec.co.jp>)
List pgsql-general
> I've got a table with the following structure:
>
> CREATE TABLE assignment_answers
> (
>     training_id INT4,
>     lesson_no INT2,
>     assignment_no INT2,
>     FOREIGN KEY( training_id, lesson_no, assignment_no ) REFERENCES
> assignment ON UPDATE CASCADE ON DELETE CASCADE,
>     participants_id INT4,
>     FOREIGN KEY( training_id, participants_id ) REFERENCES
> training_participants ON UPDATE CASCADE ON DELETE CASCADE,
>     answer TEXT,
>     isHTML boolean DEFAULT 'false',
>     submitted TIMESTAMP DEFAULT now()
> );
>
> And I have a certain function which executes the following SQL_QUERY
> under PHP:
>
> SELECT * FROM assignment_answers;
>
> After execution I check my Result resource which has the following value
>
> RESULT_SET == []
>
> Warning: Supplied argument is not a valid PostgreSQL result resource,

res = pg_Exec( conn, "SELECT * FROM assignment_answers" );
if( pg_numrows( res ) != 0 ) {
  for( i=0 ; i<pg_numrows( res ) ; ++i ) {
    row = pg_fecharray( res, i );
    /* do your stuff here */
  }
} else {
  /* report error or whatever */
}

Nix.

pgsql-general by date:

Previous
From: Russ McBride
Date:
Subject: make problems on Apple's new 10.1 os
Next
From: John Clark Naldoza y Lopez
Date:
Subject: Re: PHP Related Problem