Re: [PHP] Checking for NULL value in Database

2002-06-18 Thread Andre Dubuc

Thanks Dan,

In the interim, I solved my problem. As you said, the first query 
needed to be INSERT (that I figured out after spending some 'thoughtful' time 
with my beloved code :>, and I also eliminated the extra pg_connect. After 
that, it still wouldn't work.

Looking at the mess from pgsql (the graphical PostgreSQL interface) I noticed 
that the row that I was working on hadn't 'moved' [normally it moves to the 
bottom of the heap as the 'current record'. Seems like the index file was a 
little 'messed' up and was patiently waiting for me do to a 'vacuum' of the 
db.

Once I cleaned up the database, everything worked as expected. I guess I 
should vacuum more frequently?

Btw, you wouldn't happen to know any 'timer' script that I can program 
for seconds?

Regards,
Andre

On Tuesday 18 June 2002 03:58 pm, you wrote:
> On Mon, Jun 17, 2002 at 10:46:27AM -0400, Andre Dubuc wrote:
> > I'm tryiing to append entries in a db textarea field 'rbook'. Everything
> > works fine IF there is an existing entry. However, if no entries exist,
> > it nothing is written to the db. (PostgreSQL 7.2)
>
> I'm not familliar with PostgreSQL, but it sure looks like your problem
> stems from your using UPDATE queries.  If a record doesn't exist, there's
> no record to update.  You need to use INSERT queries in that case.
>
> Also, you only need one pg_connect() statement.  While that's not your
> problem, it's a waste to have them in there.  Just keep the one at the
> top.  Ditch the ones inside your if/else structure.
>
> --Dan

-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Checking for NULL value in Database

2002-06-18 Thread Analysis & Solutions

On Mon, Jun 17, 2002 at 10:46:27AM -0400, Andre Dubuc wrote:
> I'm tryiing to append entries in a db textarea field 'rbook'. Everything 
> works fine IF there is an existing entry. However, if no entries exist, it 
> nothing is written to the db. (PostgreSQL 7.2)

I'm not familliar with PostgreSQL, but it sure looks like your problem
stems from your using UPDATE queries.  If a record doesn't exist, there's
no record to update.  You need to use INSERT queries in that case.

Also, you only need one pg_connect() statement.  While that's not your 
problem, it's a waste to have them in there.  Just keep the one at the 
top.  Ditch the ones inside your if/else structure.

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php