Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 8F324475CE0 for ; Mon, 10 Jun 2002 05:26:39 -0400 (EDT) Received: from heidegger.catalyst.net.nz (203-96-145-236.adsl.paradise.net.nz [203.96.145.236]) by postgresql.org (Postfix) with ESMTP id 04E78475CD0 for ; Mon, 10 Jun 2002 05:26:38 -0400 (EDT) Received: from 127.0.0.1 (ident=unknown) by heidegger.catalyst.net.nz with esmtp (masqmail 0.2.9) id 17HLQy-2cR-00; Mon, 10 Jun 2002 21:25:56 +1200 Subject: Re: Multiple Table Selection From: Andrew McMillan To: arun kv Cc: PGSQL In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.5 Date: 10 Jun 2002 21:25:56 +1200 Message-Id: <1023701156.4952.72.camel@kant.mcmillan.net.nz> Mime-Version: 1.0 X-Archive-Number: 200206/13 X-Sequence-Number: 1266 On Mon, 2002-06-10 at 19:26, arun kv wrote: > hello sir, > I am having a postgresql database and using php to access the > same. i have three tables and my program has to search for the data > entered thru my php page in all these tables. > > i have to enter either of name,age or company of a person and have to > search for either of these in all the three tables and display results.for > 1 table its working fine but for 3 tables it gives me error: Unable to > jump to row 0 of postgresql result index 3 on *.php file. how can i > override this warning. i have to search all the tables if i enter 1 or 2 > or all three values. how can i do the same. Usually that error means that the query executed fine - it just found no records. Test the value of pg_NumRows($result) to see if you need to process the results, viz: $result = pg_Exec( $dbconn, $sql ); if ( !$result ) { echo "

Search failed"; // Security hole to tell the user the query is busted but we log it error_log( "Broken query: $sql", 0); } elseif( pg_NumRows($result) ) { echo ""; for( $i = 0; $i < pg_NumRows($result) ; $i ++ ) { $row = pg_Fetch_Object( $result, $i ); echo "\n"; } echo "
$row->field1$row->field2
"; } else { echo "

No Records Found"; } Which is a simplification of how I wrap many of the queries I use (I put most of this sort of logic in a standard function and just call that). Regards, Andrew. -- -------------------------------------------------------------------- Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St DDI: +64(4)916-7201 MOB: +64(21)635-694 OFFICE: +64(4)499-2267 Are you enrolled at http://schoolreunions.co.nz/ yet?