PG: Table last updated?

PG: Table last updated?

am 24.10.2007 00:12:14 von Tony Grimes

We've got a huge table in one of our Postgres databases and nobody seems to
know what it's for. Do any of the system tables keep track of the last time
the table was altered (i.e. Row INSERTs, UPDATEs, etc)?

Tony

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

RE: PG: Table last updated?

am 24.10.2007 02:20:46 von Bastien Koert

Is logging turned on?

bastien


----------------------------------------> Date: Tue, 23 Oct 2007 16:12:14 -=
0600> From: thelist@tonygrimes.com> To: php-db@lists.php.net> Subject: [PHP=
-DB] PG: Table last updated?>> We've got a huge table in one of our Postgre=
s databases and nobody seems to> know what it's for. Do any of the system t=
ables keep track of the last time> the table was altered (i.e. Row INSERTs,=
UPDATEs, etc)?>> Tony>> --> PHP Database Mailing List (http://www.php.net/=
)> To unsubscribe, visit: http://www.php.net/unsub.php>

____________________________________________________________ _____
R U Ready for Windows Live Messenger Beta 8.5? Try it today!
http://entertainment.sympatico.msn.ca/WindowsLiveMessenger=

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

Re: PG: Table last updated?

am 24.10.2007 04:31:36 von Tony Grimes

I'm not sure. How can I tell? This database is running on a different server
than the one that created the data. I'm trying to restore a fried server
from a backup. Not sure if that matters.

Tony


On 10/23/07 6:20 PM, "Bastien Koert" wrote:

>
> Is logging turned on?
>
> bastien
>
>
> ----------------------------------------> Date: Tue, 23 Oct 2007 16:12:14
> -0600> From: thelist@tonygrimes.com> To: php-db@lists.php.net> Subject:
> [PHP-DB] PG: Table last updated?>> We've got a huge table in one of our
> Postgres databases and nobody seems to> know what it's for. Do any of the
> system tables keep track of the last time> the table was altered (i.e. Row
> INSERTs, UPDATEs, etc)?>> Tony>> --> PHP Database Mailing List
> (http://www.php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php>
>
> ____________________________________________________________ _____
> R U Ready for Windows Live Messenger Beta 8.5? Try it today!
> http://entertainment.sympatico.msn.ca/WindowsLiveMessenger
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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

Phpmailer sending duplicate messages...

am 01.11.2007 21:21:25 von Stephen Sunderlin

It seems to be ccing each email to everyone and I'd like it to only include
one email address with each email. I've tested in on three of my personal
emails and I see to get six messages in my inbox.

I'm also sending about 4000 emails and would like some pointers to avoid
time out errors.

Finally for the life of me can't figure out how to execute an insert
statement to record a history of each email sent. When I include the insert
statement, no emails are send.

Following is the code.

Any help or direction would be greatly appreciated.

Thanks.

**************************



require("class.phpmailer.php");
$mail = new PHPMailer();

include ("cxnfile");
$cxn = mysqli_connect($host,$user,$password,$database)
or die ("Couldn't connect to server");

$query = "select *
From db
where groupid = groupid";

$result = mysqli_query($cxn,$query)
or die("Couldn't execute select query.");

while($row = mysqli_fetch_assoc($result))
{
extract($row);

$mail->IsSMTP();
$mail->Host = "host.com";
$mail->From = "info@host.com";

$mail->From = "info@host.com";
$mail->FromName = "Company";
$mail->AddAddress("$email", "$Contact");

$mail->IsHTML(True);
$mail->Subject = "$Subject";
$mail->Body = "$PR";
$mail->WordWrap = 50;



if(!$mail->Send())
{
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
echo 'Message has been sent.';
}

}

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

RE: Phpmailer sending duplicate messages...

am 01.11.2007 21:41:50 von Instruct ICC

--_5138fefc-70f2-483f-871a-401b6e1d2e3d_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


> while($row =3D mysqli_fetch_assoc($result))
> {
> extract($row); =20
>=20
> $mail->IsSMTP();
> $mail->Host =3D "host.com";=20
> $mail->From =3D "info@host.com";
>=20
> $mail->From =3D "info@host.com";
> $mail->FromName =3D "Company";
> $mail->AddAddress("$email", "$Contact");
>=20
> $mail->IsHTML(True); =20
> $mail->Subject =3D "$Subject";
> $mail->Body =3D "$PR";
> $mail->WordWrap =3D 50;
>=20
>=20
>=20
> if(!$mail->Send())
> {
> echo 'Message was not sent.';
> echo 'Mailer error: ' . $mail->ErrorInfo;
> }
> else
> {
> echo 'Message has been sent.';
> }
>=20
> }

I bet your while loop over the "extract" is causing you to have:
user1
user1, user2
user1, user2, user3,...

Instead of polluting your symbol table, can't you just use the email field?
$email =3D $row['theEmailField'];

I've used code like this back in the day (Notice how the array $arr was uns=
et):
$recipients =3D "arr[]=3Duser1@example.com&arr[]=3Duser2@example.com&arr[]=
=3Duser3@example.com";
parse_str($recipients);
for($i=3D0; $i mail("$arr[$i]", "$subject", "$message", "From: <$sender>\n". "Reply-To=
: <$sender>\n");
}
unset($arr);


____________________________________________________________ _____
Boo!=A0Scare away worms, viruses and so much more! Try Windows Live OneCare=
!
http://onecare.live.com/standard/en-us/purchase/trial.aspx?s _cid=3Dwl_hotma=
ilnews=

--_5138fefc-70f2-483f-871a-401b6e1d2e3d_--

Re: Phpmailer sending duplicate messages...

am 01.11.2007 21:43:24 von Stut

Stephen Sunderlin wrote:
> It seems to be ccing each email to everyone and I'd like it to only include
> one email address with each email. I've tested in on three of my personal
> emails and I see to get six messages in my inbox.
>
> I'm also sending about 4000 emails and would like some pointers to avoid
> time out errors.
>
> Finally for the life of me can't figure out how to execute an insert
> statement to record a history of each email sent. When I include the insert
> statement, no emails are send.
>
> Following is the code.
>
> Any help or direction would be greatly appreciated.
>
> Thanks.
>
> **************************
>
>
> >
> require("class.phpmailer.php");
> $mail = new PHPMailer();
>
> include ("cxnfile");
> $cxn = mysqli_connect($host,$user,$password,$database)
> or die ("Couldn't connect to server");
>
> $query = "select *
> From db
> where groupid = groupid";
>
> $result = mysqli_query($cxn,$query)
> or die("Couldn't execute select query.");
>
> while($row = mysqli_fetch_assoc($result))
> {
> extract($row);
>
> $mail->IsSMTP();
> $mail->Host = "host.com";
> $mail->From = "info@host.com";
>
> $mail->From = "info@host.com";
> $mail->FromName = "Company";
> $mail->AddAddress("$email", "$Contact");
>
> $mail->IsHTML(True);
> $mail->Subject = "$Subject";
> $mail->Body = "$PR";
> $mail->WordWrap = 50;
>
>
>
> if(!$mail->Send())
> {
> echo 'Message was not sent.';
> echo 'Mailer error: ' . $mail->ErrorInfo;
> }
> else
> {
> echo 'Message has been sent.';
> }
>
> }

You're re-using the same message each time around the loop. Each time
you call AddAddress you're, erm, adding another address. You either need
to reset the recipients or reset the message each time round the loop
(I'm not familiar with Phpmailer so I have no idea how to do this).

-Stut

--
http://stut.net/

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

RE: Phpmailer sending duplicate messages...

am 01.11.2007 22:01:07 von Instruct ICC

--_3b48c865-84b6-4a40-9980-c4bfb4ddd7cd_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


> You're re-using the same message each time around the loop. Each time=20
> you call AddAddress you're, erm, adding another address. You either need=
=20
> to reset the recipients or reset the message each time round the loop=20
> (I'm not familiar with Phpmailer so I have no idea how to do this).
>=20
> -Stut

Stut is right.

If you put
$mail =3D new PHPMailer();
within the while loop, you should be okay.

____________________________________________________________ _____
Climb to the top of the charts!=A0 Play Star Shuffle:=A0 the word scramble =
challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=3Dstarshuffle_wl mailtextlink_oc=
t=

--_3b48c865-84b6-4a40-9980-c4bfb4ddd7cd_--

RE: inserting history after sending phpmailer message

am 02.11.2007 03:29:39 von Instruct ICC

--_470e7095-0c05-45a9-b8ec-07a95a4678c9_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable


> So the following code is now sending one email to each recipient but now
> that'd I've added the insert statement at the bottom it only sends one em=
ail
> and one history and I get the following error message"
>=20
> Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result,
> boolean given in /testmailer.php on line 19
>=20
>=20
> The select query calls three different email addresses.
>=20
> Any thoughts?
>=20
> **************************************
>=20
> >=20
> require("class.phpmailer.php");
> $mail =3D new PHPMailer();
>=20
> include ("conection"); =20
> $cxn =3D mysqli_connect($host,$user,$password,$database)
> or die ("Couldn't connect to server");
>=20
> $query =3D "select email, c.VID VID, Contact, Subject, PR, TPR
> From cdb c, edb e, pressdb p
> where c.vid =3D e.vid
> and c.VID =3D 15
> and PressUID =3D 19";
>=20
> $result =3D mysqli_query($cxn,$query)
> or die("Couldn't execute select query.");
> =09
> while($row =3D mysqli_fetch_assoc($result))
> {
> extract($row); =20
>=20
>=20
> $mail->IsSMTP();=20
> $mail->Host =3D "host.com"; // SMTP server
> $mail->From =3D "info@host.com";
>=20
> $mail->From =3D "info@host.com";
> $mail->FromName =3D "From Name";
> $mail->AddAddress("$email", "$Contact");
>=20
> $mail->IsHTML(True); // set email format=
to
> HTML
> $mail->Subject =3D "$Subject";
> $mail->Body =3D "$PR";
> $mail->WordWrap =3D 50;
>=20
>=20
> if(!$mail->Send())
> {
> echo 'Message was not sent.';
> echo 'Mailer error: ' . $mail->ErrorInfo;
> }
> else
> {
> echo 'Message has been sent.';
> }
> $query =3D "insert into hdb (VID, CTS, RecordManager, Type,Regarding)
> Values ($VID,NOW(),'User', 16,'$Subject')";
> $result =3D mysqli_query($cxn,$query)
> or die("Couldn't insert history.");
>=20
>=20
> $mail->ClearAddresses();
> }
> ?>

1) You should reply to the list to benefit the list and maybe get more/bett=
er answers than a single person can provide.
2) Your insert query at the bottom overwrites the $result you are using to =
loop over. The insert gave a valid "true" $result, but the looping fetch c=
ouldn't get the next record. Maybe use $resultSelect and $resultInsert inst=
ead?
3) I think you are writing the literal string $Subject since you surround i=
t with single quotes on the insert at the bottom.
4) I think the best you get from PHP "mail()" or PHPmailer "->Send()" is th=
at your email has been "accepted for delivery", not that the recipient rece=
ived it.

____________________________________________________________ _____
Windows Live Hotmail and Microsoft Office Outlook =96 together at last. =A0=
Get it now.
http://office.microsoft.com/en-us/outlook/HA102225181033.asp x?pid=3DCL10062=
6971033=

--_470e7095-0c05-45a9-b8ec-07a95a4678c9_--

RE: Phpmailer sending duplicate messages...

am 02.11.2007 03:32:25 von Instruct ICC

--_1b095c9d-28ba-4809-b5fb-e17f30e48ce2_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


> Stut and Instruct
>=20
> Just found this which clears the email after each loop.
>=20
> $mail->ClearAddresses();
>=20
> Thanks for you input.

Good find. Now the list can benefit.

____________________________________________________________ _____
Climb to the top of the charts!=A0 Play Star Shuffle:=A0 the word scramble =
challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=3Dstarshuffle_wl mailtextlink_oc=
t=

--_1b095c9d-28ba-4809-b5fb-e17f30e48ce2_--

Re: PG: Table last updated?

am 05.11.2007 02:53:32 von dmagick

Tony Grimes wrote:
> We've got a huge table in one of our Postgres databases and nobody seems to
> know what it's for. Do any of the system tables keep track of the last time
> the table was altered (i.e. Row INSERTs, UPDATEs, etc)?

I don't think so, but the postgresql-general mailing list might be a
better place to ask (http://www.postgresql.org/community/lists/).

--
Postgresql & php tutorials
http://www.designmagick.com/

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