Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2000121

Re: [PHP-DB] Checking before INSERT From: John Starkey (jstarkey <email protected>)
Date: 12/09/00

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 <email protected>> wrote in message
> news:Pine.LNX.4.21.0012082335590.11437-100000 <email protected>
> > 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 <email protected>
> > For additional commands, e-mail: php-db-help <email protected>
> > To contact the list administrators, e-mail: php-list-admin <email protected>
> >
>
>
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>