[PHP-DB] safe way to retrieve the record i just inserted

2002-11-24 Thread Dave
Hi everyone, I am new to the forum. I am using PHP and PostgreSQL. After I insert into a table "Task" who's primary key is a serial type (auto sequence number) I would like to immediately retrieve that generated sequence number to use for subsequent inserts into another table "Points." So what i

Re: [PHP-DB] safe way to retrieve the record i just inserted

2002-11-24 Thread Dave Smith
Perhaps pg_last_oid() will help: http://www.php.net/manual/en/function.pg-last-oid.php --Dave Dave wrote: Hi everyone, I am new to the forum. I am using PHP and PostgreSQL. After I insert into a table "Task" who's primary key is a serial type (auto sequence number) I would like to immediately

[PHP-DB] Sessions Vs DB Access

2002-11-24 Thread Chris Payne
Hi there everyone, I have a system I am programming, and each page needs to get various config elements from a DB, of course this means lots of DB access for each page. What I was wondering is, after the user has logged in successfully it currently stores their email, name, address and a few other

[PHP-DB] Deleting topics older than 2 hours?

2002-11-24 Thread Leif K-Brooks
I'm trying to run a cron job to delete forum topics more than 2 hours old. I know how to do that, but the problem is also deleting the posts in the topic at the same time. Can someone shed some light on this, please? -- The above message is encrypted with double rot13 encoding. Any unauthoriz

Re: [PHP-DB] Deleting topics older than 2 hours?

2002-11-24 Thread DL Neil
Sorry Leif, but CrystalBall v2.6 is currently unable to help. The word WHERE features. Show us the money - or second choice: the (erroneous) code... =dn > I'm trying to run a cron job to delete forum topics more than 2 hours > old. I know how to do that, but the problem is also deleting the post

Re: [PHP-DB] Deleting topics older than 2 hours?

2002-11-24 Thread Leif K-Brooks
Sounds to me like you didn't understand the question. The table structure is something like: topics_ | id | forum | author | subject | posttime | - _posts | id | topic | author | message | posttime| -

Re: [PHP-DB] Sessions Vs DB Access

2002-11-24 Thread Dave Smith
Chris, I'm assuming you're running this thing on *nix. Session variables are stored on the file system. PHP writes them out to /tmp, where it subsequently reads them upon request. The question is: How good at caching is your DB? If it can cache common select queries, then you are probably bett

Re: [PHP-DB] Deleting topics older than 2 hours?

2002-11-24 Thread DL Neil
Leif, > Sounds to me like you didn't understand the question. The table =two sides to every story: either I'm too thick to understand, or you didn't explain sufficiently - or both... see problem with necessarily open-ended answer given below and consider... > structure is something like: > __

Re: [PHP-DB] Sessions Vs DB Access

2002-11-24 Thread Peter Beckman
Don't forget that you can use the DB to store PHP Sessions as well, which is faster than storing the sessions in /tmp on the file system. If you have well written SQL, you can have 5-30 queries per page, most of which should return the data in under 1/100 of a second. I was running a site doing 1

RE: [PHP-DB] Deleting topics older than 2 hours?

2002-11-24 Thread John W. Holmes
[snip] > =others, eg MySQL, do not, and thus unless MySQL's last DELETE format > option > works sufficiently well, the best option might be two DELETE's: the first > per your suggestion above and the second to remove all entries in posts > that > no longer join to a topics row. But you can't join

[PHP-DB] Updating data

2002-11-24 Thread Gavin Amm
Hi, I'm trying to update a table ("count") & have been staring at it for a while now & can't see why it won't update... here's the code: $page_count = $page_count + 1; $sql = "UPDATE count SET num='$page_count' WHERE dept='$dept' AND deptsub='$deptsub'"; $result = mysql_query($sql, $db); when

RE: [PHP-DB] Updating data - don't worry, resolved.

2002-11-24 Thread Gavin Amm
I've realised my problem, i was trying to read the number of rows & add 1 to that. (instead of the data in the num field & add 1 to that...) of course it will return 1 each time! Gav -Original Message- From: Gavin Amm [mailto:[EMAIL PROTECTED]] Sent: Monday, 25 November 2002 11:38 AM To