Re: Checking before INSERT

From: Date: Sat, 09 Dec 2000 15:26:47 +0000
Subject: Re: Checking before INSERT
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-5124@lists.php.net to get a copy of this message
Ok, it's gotta be me then. How I'm laying this out. Because doing what you recommend below throws an exception no matter where I put it. How should I do this: $get_it = "SELECT something FROM wherever WHERE something_else = this;"; $got_it = pg_Exec ($conn, $get_it); $it_is = pg_result ($got_it, "row", "column"); if ($it_is) { do whatever; } This is gonna throw an exception. I tried if($got_it) and it's returning false continually (the row is there). Thanks, Charlie :} On Sat, 9 Dec 2000, Joe Brown wrote: > Sorry Charlie, > This aint dbase anymore. > If you really need to know if a row exists, you're gonna have to query the > database. You should be able to do a simple > SELECT count(*) cnt FROM your_table WHERE your_condition=true; > > Client server architechure requires a little of work, but it's a lot more > powerful than good 'ol dbase. > > "John Starkey" <jstarkey@advancecreations.com> wrote in message > > news:Pine.LNX.4.21.0012082335590.11437-100000@localhost.localdomain... > > Can someone tell me how to check that a row doesn't exist before I add > > it? > > > > Do I really have to create a conditional using $query, pg_Exec, and > > pg_result as the conditions? > > > > I've looked thru the PHP manual and the postgres sites and came up with > > nothing. > > > > Thanks, > > > > John > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > > For additional commands, e-mail: php-db-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > >

« previous php.db (#5124) next »