[PHP-DB] Keeping the mailing list sain
Hi guys, So that I don't drive members of the mailing list insane: In Outlook XP (2002), I want to enable the "Out of office" feature; what I don't want to do is have it reply to every message posted to the PHP mailing list. Does anyone know how to create a rule, to do this? I really don't want to unsubscribe & subscribe to the list every time I go out of the office... Thanks, Gav -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] COUNT() returns 1, but should be 0
John, >That's because you're displaying how many "rows" were returned from the >query, not the value that COUNT() returns. A query with COUNT() is >always going to return at least one row. > >$visitcount = mysql_result($query,0); Yes, that was it! Thank you so much. Lew -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] COUNT() returns 1, but should be 0
Lew Mark-Andrews wrote: I get a count of 1 for the number of visits ($visitcount) using my following code. It should be 0. --- code in check_visits.php $sql = "SELECT COUNT(visitdate) FROM cardlist GROUP BY visitdate"; $query = mysql_query($sql) or die(" Cannot query the database." . "MySQL Error No. " . mysql_errno() . " : " . mysql_error() . ""); $visitcount = mysql_num_rows($query); [snip] echo "Total number of users: $usercount"; echo "Total number of visits: $visitcount"; // <--- Should be zero. That's because you're displaying how many "rows" were returned from the query, not the value that COUNT() returns. A query with COUNT() is always going to return at least one row. $visitcount = mysql_result($query,0); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] COUNT() returns 1, but should be 0
On Mon, Dec 22, 2003 at 11:43:35AM +0900, Lew Mark-Andrews wrote: > Table structure for cardlist: > `visitdate` datetime default NULL, > $sql = "SELECT COUNT(visitdate) FROM cardlist GROUP BY visitdate"; > $visitcount = mysql_num_rows($query); > echo "Total number of visits: $visitcount"; // <--- Should be zero. I think that there is one visitdate (NULL), so one row is returned. HTH, Tobey Wheelock -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP/DB speed
At 03:15 PM 12/21/2003 -0700, Robin Kopetzky wrote: Good afternoon! I am writing a project and have a speed concern... The code I am using is thus and is retrieving around 2,500 records: $result = mysql_query($sql) while ($row = mysql_fetch_array($result)) { build stmt } Is there a faster method? Timed this with microtime and .9 seconds to retrieve the data and output the web page seems REAL slow. Now this is on a T-Base-100 network but I imagine it would be like watching paint dry in a 56K modem. Any thoughts, ideas on accelerating this? I did try ob_start() and ob_end_flush() and no help... Thank for any help in advance. Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 Robin, That's a huge option list. Just from the point of view of the user it is too large. Is there any way you can pare it down? MySQL will select those records really quickly, but then the HTML has to be generated and the broser has to render the list. Try and rethink this if you can. Regards - Miles Thompson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] COUNT() returns 1, but should be 0
Hi all, I'm baffled by this. I've put together a rather simple newsletter + greeting card app for a company to send their clients personalized corporate e-mails each containing the URL link to the greeting card page. When the user successfully visits the view card page, my code writes the visit date to the cardlist db (MySQL). One of the admin pages (check_visits.php) lets the admin view a table listing of all the user names, email addresses, card sent date and card seen date. Above this table I display the total number of users and the total number of visits. Presently, the table has only 160 records. No cards have been sent yet and thus no visits, but I get a count of 1 for the number of visits ($visitcount) using my following code. It should be 0. The number of users ($usercount) is returned correctly at 160. Any ideas/advice would be much appreciated. Thanks, Lew --- MySQL: 3.23.54 PHP: 4.3.1 Linux --- Table structure for cardlist: `custid` int(10) unsigned NOT NULL auto_increment, `fullname` varchar(100) NOT NULL default '', `email` varchar(100) NOT NULL default '', `cardid` varchar(12) NOT NULL default '0', `sentdate` datetime default NULL, `visitdate` datetime default NULL, PRIMARY KEY (`custid`), UNIQUE KEY `email` (`email`) --- code in check_visits.php $sql = "SELECT COUNT(visitdate) FROM cardlist GROUP BY visitdate"; $query = mysql_query($sql) or die(" Cannot query the database." . "MySQL Error No. " . mysql_errno() . " : " . mysql_error() . ""); $visitcount = mysql_num_rows($query); $sql = "SELECT * FROM cardlist"; $query = mysql_query($sql) or die(" Cannot query the database." . "MySQL Error No. " . mysql_errno() . " : " . mysql_error() . ""); $usercount = mysql_num_rows($query); echo "Total number of users: $usercount"; echo "Total number of visits: $visitcount"; // <--- Should be zero. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP/DB speed
Hello Robin, Sunday, December 21, 2003, 10:15:35 PM, you wrote: RK> The code I am using is thus and is retrieving around 2,500 records: RK> $result = mysql_query($sql) RK> while ($row = mysql_fetch_array($result)) RK> { RK> build stmt RK> } You're building a select list of 2500 elements? No wonder it's slow. That must be generating a few hundred KB's worth of HTML on its own, let alone anything else on the page. If you're not using all 2500 rows, you need to optimise your query to reflect this. -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Reading emails with PHP
Hello, On 12/19/2003 09:54 AM, David T-G wrote: OK, so on to the script. Just as PHP has classes, perl has modules which implement object code. Just as PHP has PEAR (I think; I'm still getting to know it), perl has CPAN, the Comprehensive Perl Archive Network. One advantage of perl's maturity is an almost ridiculously vast wealth of contributed modules; if you want to do it, someone has almost certainly already written a module for it. [This is already on the way for PHP and PEAR; in just a few years I, too, predict that PHP will be hugely popular.] The one used here is Mail::DeliveryStatus::BounceParser. This solution has two significant limitations: 1) Many bounces will not be returned as delivery status messages 2) Many users may be register with e-mail addresses which are just forwarding addresses, so the address returned by the report specifies the final address and not the actual address of subscription. A more useful solution is one based on setting the return path address of the message being sent in such a way that you can retrieve the original recipient address from the bounced message recipient address. This has just been discussed here: http://marc.theaimsgroup.com/?t=1071585&r=1&w=2 -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: php mail() question
Hello, On 12/18/2003 10:44 AM, Jerry wrote: How do I list the headers that are ouputed in the page into the text area also? You just need to call the RetrieveMessage function that returns the headers of each message and then look for the To: header. -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP/DB speed
Robin Kopetzky wrote: Good afternoon! I am writing a project and have a speed concern... The code I am using is thus and is retrieving around 2,500 records: $result = mysql_query($sql) while ($row = mysql_fetch_array($result)) { build stmt } Is there a faster method? Timed this with microtime and .9 seconds to retrieve the data and output the web page seems REAL slow. Now this is on a T-Base-100 network but I imagine it would be like watching paint dry in a 56K modem. Any thoughts, ideas on accelerating this? I did try ob_start() and ob_end_flush() and no help... Any time you put 2500 elements into a SELECT box, it's going to be slow. The browser is going to take a noticable time rendering that box. Are you actually building the list up in a variable before displaying it or just echoing it outright? Building the whole thing up into a variable will take longer than just echoing it directly to the browser. Other than that, if you're not willing to change your UI so you don't have a 2500 element select box, there's not much you can do. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP/DB speed
Good afternoon! I am writing a project and have a speed concern... The code I am using is thus and is retrieving around 2,500 records: $result = mysql_query($sql) while ($row = mysql_fetch_array($result)) { build stmt } Is there a faster method? Timed this with microtime and .9 seconds to retrieve the data and output the web page seems REAL slow. Now this is on a T-Base-100 network but I imagine it would be like watching paint dry in a 56K modem. Any thoughts, ideas on accelerating this? I did try ob_start() and ob_end_flush() and no help... Thank for any help in advance. Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php