GREAT. This does the trick for me. Thanks a lot. I am now getting
the output I want, so I can now feel confident about inputting this into the
actual database.
-----Original Message-----
From: Katie Evans-Young [
mailto:katie682@xxxxxxxxxxx]
Sent: Wednesday, March 12, 2003 11:21 AM
To: NIPP, SCOTT V (SBCSI)
Subject: RE: [PHP-DB] Easy array question...
It's actually putting the whole of the array $other as the first element of
the array $other2. You're going to have to step through the array to copy
it.
foreach($other as $element) {
$other2[] = $element;
} //end foreach
-----Original Message-----
From: NIPP, SCOTT V (SBCSI) [
mailto:sn4265@xxxxxxx]
Sent: Wednesday, March 12, 2003 11:10 AM
To: 'jvilla@xxxxxxxxxxxxxxx'; 'Hutchins, Richard'; php-db@xxxxxxxxxxxxx
Subject: RE: [PHP-DB] Easy array question...
Here is basically what I have and what I am getting...
The section of code to copy and then process the copied array:
$other2 = array();
array_push($other2, $other);
foreach ($other2 as $test) {
if ($test == "") {
echo "NOTHING"."<br>";
} else {
echo $test."<br>";
}
}
Basically, what I want is if the array element is nothing, then
output as a test NOTHING. If the array element has some value, then output
as a test that value. Currently, from this code the output I am actually
getting is:
Array
Thanks again.
-----Original Message-----
From: Jonathan Villa [
mailto:jvilla@xxxxxxxxxxxxxxx]
Sent: Wednesday, March 12, 2003 10:58 AM
To: jvilla@xxxxxxxxxxxxxxx; NIPP, SCOTT V (SBCSI); 'Hutchins, Richard';
php-db@xxxxxxxxxxxxx
Subject: RE: [PHP-DB] Easy array question...
Sorry, I just reread your post
$array_copy = array();
array_push($array_copy, $original_array);
echo $array_copy[0];//or whatever to test
---> Jonathan
-----Original Message-----
From: Jonathan Villa [
mailto:jvilla@xxxxxxxxxxxxxxx]
Sent: Wednesday, March 12, 2003 10:56 AM
To: 'NIPP, SCOTT V (SBCSI)'; 'Hutchins, Richard'; php-db@xxxxxxxxxxxxx
Subject: RE: [PHP-DB] Easy array question...
$array_copy = array();
array_push($array_copy, $_SESSION['original_array']);
echo $array_copy[0];//or whatever to test
---> Jonathan
-----Original Message-----
From: NIPP, SCOTT V (SBCSI) [
mailto:sn4265@xxxxxxx]
Sent: Wednesday, March 12, 2003 10:43 AM
To: 'Hutchins, Richard'; 'php-db@xxxxxxxxxxxxx'
Subject: RE: [PHP-DB] Easy array question...
I don't think that is the case because I am able to access the
original array in this same page without having to use the session
variable
reference. Won't hurt to give it a try though. Thanks for the
feedback.
-----Original Message-----
From: Hutchins, Richard [
mailto:Richard.Hutchins@xxxxxxxxxxxxxx]
Sent: Wednesday, March 12, 2003 10:40 AM
To: 'php-db@xxxxxxxxxxxxx'
Subject: RE: [PHP-DB] Easy array question...
Are you using:
$array2 = $_SESSION["array1"];
Not sure that will do the trick, but it was my first inclination.
Rich
>
-----Original Message-----
>
From: NIPP, SCOTT V (SBCSI) [mailto:sn4265@xxxxxxx]
>
Sent: Wednesday, March 12, 2003 11:37 AM
>
To: 'php-db@xxxxxxxxxxxxx'
>
Subject: [PHP-DB] Easy array question...
>
>
>
I create an array on one page and then process it on
>
the next page
>
as I have registered the array as a session variable. I need
>
to basically
>
process one of these arrays twice, so I want to make a copy
>
of the array.
>
The question is how do I do this? I have tried the following:
>
>
$array2 = $array1;
>
>
This doesn't seem to do the trick for me. Is this
>
correct and I am
>
just missing something elsewhere, or is there another way to
>
copy an array?
>
Thanks.
>
>
Scott Nipp
>
Phone: (214) 858-1289
>
E-mail: sn4265@xxxxxxx
>
Web: http:\\ldsa.sbcld.sbc.com
>
>
>
>
--
>
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
--
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
--
PHP Database Mailing List (
http://www.php.net/)
To unsubscribe, visit:
http://www.php.net/unsub.php
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.445 / Virus Database: 250 - Release Date: 1/21/2003
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.445 / Virus Database: 250 - Release Date: 1/21/2003
--
PHP Database Mailing List (
http://www.php.net/)
To unsubscribe, visit:
http://www.php.net/unsub.php
Thread at a glance:
Previous Message by Date:
click to view message preview
RE: Re: Real Killer App!
Even if the system is working correctly the first couple times, it may go
into an endless loop if you do not specify the right conditions, for any
programming application ...
I am very curious about this project ... is it open source? If so, I'd be
interested in taking a look at how you implemented it.
Thanks,
Matthew Moldvan.
System Administrator,
Trilogy International, Inc.
http://www.trilogyintl.com/
-----Original Message-----
From: Nicholas Fitzgerald [mailto:nick@xxxxxxxxxx]
Sent: Wednesday, March 12, 2003 7:58 AM
To: php-db@xxxxxxxxxxxxx
Subject: Re: [PHP-DB] Re: Real Killer App!
Well, I'm not locking them out exactly, but for good reason. When a url
is first submitted it goes into the database with a checksum value of 0
and a date of 0000-00-00. If the checksum is 0 the spider will process
that url and update the record with the proper info. If the checksum is
not 0, then it checks the date. If the date is passed the date for
reindexing then it goes ahead and updates the record, it also checks
against the checksum to see if the url has changed, in which case it
updates.
It does look like it's going into an endless loop, but the strange thing
is that it goes through the loop successfully a couple of times first.
That's what's got me confused.
Nick
Nelson Goforth wrote:
> Do you "lock out" the URLs that have already been indexed? I'm
> wondering if your system is going into an endless loop?
>
>
--
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
Next Message by Date:
click to view message preview
newsletter optimization help needed
Hi there Everyone,
Below is some code I use to send a newsletter to clients subscribed on
my mailing list. The problem is I have over
9000+ email addresses in the DB and it takes around 30-45 minutes to
send them with the below code.
Can anyone see someway I can optimize it so it sends out the newsletter
any faster? I've probably gone about
this system the long way, but it works - I just need to find a way to
make it faster :-(
Thanks everyone
All the best
Chris
---
<?
$connection = mysql_connect("localhost","Username","Password") or
die("Couldn't make a connection.");
$db = mysql_select_db("WhateverDB", $connection)
or die("Couldn't select database.");
$sql = "SELECT *
FROM emailtest";
$sql_result = mysql_query($sql,$connection)
or die("Couldn't execute query.");
while ($row = mysql_fetch_array($sql_result)) {
$emailadd = $row["EMail"];
$emailname = $row["emailname"];
$emailphone = $row["emailphone"];
$emailaddress = $row["emailaddress"];
$MP = "sendmail -t";
$HT = "<html><body>";
$HT = "</body></html>";
$subject = "$subject";
$NOTE = "$emailtests";
$NOTE = str_replace("*email*", "$emailadd", $NOTE);
$NOTE = str_replace("*name*", "$emailname", $NOTE);
$NOTE = str_replace("*phone*", "$emailphone", $NOTE);
$NOTE = str_replace("*address*", "$emailaddress", $NOTE);
$TO = "$emailadd";
$fd = popen($MP,"w");
fputs($fd,"MIME-Version: 1.0\r\n");
fputs($fd,"Content-type: text/html; charset=iso-8859-1\r\n");
fputs($fd, "To: $TO\n");
fputs($fd, "From: sales@xxxxxx\n");
fputs($fd, "Subject: $subject\n");
fputs($fd, "X-Mailer: PHP3\n");
fputs($fd, "Email: $email\n");
fputs($fd, "$HT");
fputs($fd, "$NOTE");
fputs($fd, "$EHT");
}
pclose($fd);
exit;
mysql_free_result($sql_result);
mysql_close($connection);
?>
Previous Message by Thread:
click to view message preview
RE: Easy array question...
Try it with the original array first, just for testing
---> Jonathan
-----Original Message-----
From: NIPP, SCOTT V (SBCSI) [mailto:sn4265@xxxxxxx]
Sent: Wednesday, March 12, 2003 11:10 AM
To: 'jvilla@xxxxxxxxxxxxxxx'; 'Hutchins, Richard'; php-db@xxxxxxxxxxxxx
Subject: RE: [PHP-DB] Easy array question...
Here is basically what I have and what I am getting...
The section of code to copy and then process the copied array:
$other2 = array();
array_push($other2, $other);
foreach ($other2 as $test) {
if ($test == "") {
echo "NOTHING"."<br>";
} else {
echo $test."<br>";
}
}
Basically, what I want is if the array element is nothing, then
output as a test NOTHING. If the array element has some value, then
output
as a test that value. Currently, from this code the output I am
actually
getting is:
Array
Thanks again.
-----Original Message-----
From: Jonathan Villa [mailto:jvilla@xxxxxxxxxxxxxxx]
Sent: Wednesday, March 12, 2003 10:58 AM
To: jvilla@xxxxxxxxxxxxxxx; NIPP, SCOTT V (SBCSI); 'Hutchins, Richard';
php-db@xxxxxxxxxxxxx
Subject: RE: [PHP-DB] Easy array question...
Sorry, I just reread your post
$array_copy = array();
array_push($array_copy, $original_array);
echo $array_copy[0];//or whatever to test
---> Jonathan
-----Original Message-----
From: Jonathan Villa [mailto:jvilla@xxxxxxxxxxxxxxx]
Sent: Wednesday, March 12, 2003 10:56 AM
To: 'NIPP, SCOTT V (SBCSI)'; 'Hutchins, Richard'; php-db@xxxxxxxxxxxxx
Subject: RE: [PHP-DB] Easy array question...
$array_copy = array();
array_push($array_copy, $_SESSION['original_array']);
echo $array_copy[0];//or whatever to test
---> Jonathan
-----Original Message-----
From: NIPP, SCOTT V (SBCSI) [mailto:sn4265@xxxxxxx]
Sent: Wednesday, March 12, 2003 10:43 AM
To: 'Hutchins, Richard'; 'php-db@xxxxxxxxxxxxx'
Subject: RE: [PHP-DB] Easy array question...
I don't think that is the case because I am able to access the
original array in this same page without having to use the session
variable
reference. Won't hurt to give it a try though. Thanks for the
feedback.
-----Original Message-----
From: Hutchins, Richard [mailto:Richard.Hutchins@xxxxxxxxxxxxxx]
Sent: Wednesday, March 12, 2003 10:40 AM
To: 'php-db@xxxxxxxxxxxxx'
Subject: RE: [PHP-DB] Easy array question...
Are you using:
$array2 = $_SESSION["array1"];
Not sure that will do the trick, but it was my first inclination.
Rich
> -----Original Message-----
> From: NIPP, SCOTT V (SBCSI) [mailto:sn4265@xxxxxxx]
> Sent: Wednesday, March 12, 2003 11:37 AM
> To: 'php-db@xxxxxxxxxxxxx'
> Subject: [PHP-DB] Easy array question...
>
>
> I create an array on one page and then process it on
> the next page
> as I have registered the array as a session variable. I need
> to basically
> process one of these arrays twice, so I want to make a copy
> of the array.
> The question is how do I do this? I have tried the following:
>
> $array2 = $array1;
>
> This doesn't seem to do the trick for me. Is this
> correct and I am
> just missing something elsewhere, or is there another way to
> copy an array?
> Thanks.
>
> Scott Nipp
> Phone: (214) 858-1289
> E-mail: sn4265@xxxxxxx
> Web: http:\\ldsa.sbcld.sbc.com
>
>
>
> --
> 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
--
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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Next Message by Thread:
click to view message preview
newsletter optimization help needed
Hi there Everyone,
Below is some code I use to send a newsletter to clients subscribed on
my mailing list. The problem is I have over
9000+ email addresses in the DB and it takes around 30-45 minutes to
send them with the below code.
Can anyone see someway I can optimize it so it sends out the newsletter
any faster? I've probably gone about
this system the long way, but it works - I just need to find a way to
make it faster :-(
Thanks everyone
All the best
Chris
---
<?
$connection = mysql_connect("localhost","Username","Password") or
die("Couldn't make a connection.");
$db = mysql_select_db("WhateverDB", $connection)
or die("Couldn't select database.");
$sql = "SELECT *
FROM emailtest";
$sql_result = mysql_query($sql,$connection)
or die("Couldn't execute query.");
while ($row = mysql_fetch_array($sql_result)) {
$emailadd = $row["EMail"];
$emailname = $row["emailname"];
$emailphone = $row["emailphone"];
$emailaddress = $row["emailaddress"];
$MP = "sendmail -t";
$HT = "<html><body>";
$HT = "</body></html>";
$subject = "$subject";
$NOTE = "$emailtests";
$NOTE = str_replace("*email*", "$emailadd", $NOTE);
$NOTE = str_replace("*name*", "$emailname", $NOTE);
$NOTE = str_replace("*phone*", "$emailphone", $NOTE);
$NOTE = str_replace("*address*", "$emailaddress", $NOTE);
$TO = "$emailadd";
$fd = popen($MP,"w");
fputs($fd,"MIME-Version: 1.0\r\n");
fputs($fd,"Content-type: text/html; charset=iso-8859-1\r\n");
fputs($fd, "To: $TO\n");
fputs($fd, "From: sales@xxxxxx\n");
fputs($fd, "Subject: $subject\n");
fputs($fd, "X-Mailer: PHP3\n");
fputs($fd, "Email: $email\n");
fputs($fd, "$HT");
fputs($fd, "$NOTE");
fputs($fd, "$EHT");
}
pclose($fd);
exit;
mysql_free_result($sql_result);
mysql_close($connection);
?>