[PHP-DB] mysql_fetch_array limit? - more details
I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5. In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT. According to the manual, TEXT will give me a maximum space of 65,536 bytes per field. I've entered text in this field in the amount of approximately 500 characters. I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: .. $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; ... What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. Another possibility is that the mysql_query() could be truncing the result. I've checked my data directly in MySQL, and all the characters are there in direct SELECTs. Can someone please help? I've checked all manuals and FAQs I can, but I can't figure out why I'm having this problem. It should not be happening at all. Is there some size limitation to the array created via mysql_fetch_array()? Is there some other function that will accomodate my data? Is there any custom code to handle my data correctly? Thanks, Paul Worthington [EMAIL PROTECTED] -- The views expressed here are those of the user, not necessarily those of Evolving Systems, Inc. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql_fetch_array limit? - more details
Maybe it will help you but I've read that when using persistent connections PHP uses 2 on every request. So if in one moment you have 10 scripts,that use persistent connections, running you will have 20 connections used to the mysql. Regards, Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 5:34 PM Subject: [PHP-DB] mysql_fetch_array limit? - more details I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5. In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT. According to the manual, TEXT will give me a maximum space of 65,536 bytes per field. I've entered text in this field in the amount of approximately 500 characters. I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: .. $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; ... What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. Another possibility is that the mysql_query() could be truncing the result. I've checked my data directly in MySQL, and all the characters are there in direct SELECTs. Can someone please help? I've checked all manuals and FAQs I can, but I can't figure out why I'm having this problem. It should not be happening at all. Is there some size limitation to the array created via mysql_fetch_array()? Is there some other function that will accomodate my data? Is there any custom code to handle my data correctly? Thanks, Paul Worthington [EMAIL PROTECTED] -- The views expressed here are those of the user, not necessarily those of Evolving Systems, Inc. -- 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
Re: [PHP-DB] mysql_fetch_array limit? - more details
Thank you for that idea. I don't think that's it, though, because this script is the only one I'm ever running on this site. The problem is perfectly consistent and repeatable, which leads me to believe it's something in the way the array is being built. Paul Worthington [EMAIL PROTECTED] Andrey Hristov [EMAIL PROTECTED] wrote in message 01cd01c237e8$7e1438b0$1601a8c0@nik">news:01cd01c237e8$7e1438b0$1601a8c0@nik... Maybe it will help you but I've read that when using persistent connections PHP uses 2 on every request. So if in one moment you have 10 scripts,that use persistent connections, running you will have 20 connections used to the mysql. Regards, Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 5:34 PM Subject: [PHP-DB] mysql_fetch_array limit? - more details I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5. In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT. According to the manual, TEXT will give me a maximum space of 65,536 bytes per field. I've entered text in this field in the amount of approximately 500 characters. I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: .. $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; ... What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. Another possibility is that the mysql_query() could be truncing the result. I've checked my data directly in MySQL, and all the characters are there in direct SELECTs. Can someone please help? I've checked all manuals and FAQs I can, but I can't figure out why I'm having this problem. It should not be happening at all. Is there some size limitation to the array created via mysql_fetch_array()? Is there some other function that will accomodate my data? Is there any custom code to handle my data correctly? Thanks, Paul Worthington [EMAIL PROTECTED] -- The views expressed here are those of the user, not necessarily those of Evolving Systems, Inc. -- 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
Re: [PHP-DB] mysql_fetch_array limit? - more details
Do you have PhpMyAdmin installed? If you have try with it to see the results. It uses native mysql functions. Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 7:53 PM Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details Thank you for that idea. I don't think that's it, though, because this script is the only one I'm ever running on this site. The problem is perfectly consistent and repeatable, which leads me to believe it's something in the way the array is being built. Paul Worthington [EMAIL PROTECTED] Andrey Hristov [EMAIL PROTECTED] wrote in message 01cd01c237e8$7e1438b0$1601a8c0@nik">news:01cd01c237e8$7e1438b0$1601a8c0@nik... Maybe it will help you but I've read that when using persistent connections PHP uses 2 on every request. So if in one moment you have 10 scripts,that use persistent connections, running you will have 20 connections used to the mysql. Regards, Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 5:34 PM Subject: [PHP-DB] mysql_fetch_array limit? - more details I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5. In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT. According to the manual, TEXT will give me a maximum space of 65,536 bytes per field. I've entered text in this field in the amount of approximately 500 characters. I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: .. $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; ... What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. Another possibility is that the mysql_query() could be truncing the result. I've checked my data directly in MySQL, and all the characters are there in direct SELECTs. Can someone please help? I've checked all manuals and FAQs I can, but I can't figure out why I'm having this problem. It should not be happening at all. Is there some size limitation to the array created via mysql_fetch_array()? Is there some other function that will accomodate my data? Is there any custom code to handle my data correctly? Thanks, Paul Worthington [EMAIL PROTECTED] -- The views expressed here are those of the user, not necessarily those of Evolving Systems, Inc. -- 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
Re: [PHP-DB] mysql_fetch_array limit? - more details
No I don't have PhpMyAdmin installed. I work directly in MySQL via a terminal, so all my checking is with native calls anyway. Working natively in MySQL, all my data is there and everything works the way I expect it to. Using mysql_fetch_array() in PHP results in a truncated result set. And I am trying to figure out why, and how I can work around this problem. Thanks again, Paul Worthington [EMAIL PROTECTED] Andrey Hristov [EMAIL PROTECTED] wrote in message 01ed01c237ea$0d0fcf10$1601a8c0@nik">news:01ed01c237ea$0d0fcf10$1601a8c0@nik... Do you have PhpMyAdmin installed? If you have try with it to see the results. It uses native mysql functions. Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 7:53 PM Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details Thank you for that idea. I don't think that's it, though, because this script is the only one I'm ever running on this site. The problem is perfectly consistent and repeatable, which leads me to believe it's something in the way the array is being built. Paul Worthington [EMAIL PROTECTED] Andrey Hristov [EMAIL PROTECTED] wrote in message 01cd01c237e8$7e1438b0$1601a8c0@nik">news:01cd01c237e8$7e1438b0$1601a8c0@nik... Maybe it will help you but I've read that when using persistent connections PHP uses 2 on every request. So if in one moment you have 10 scripts,that use persistent connections, running you will have 20 connections used to the mysql. Regards, Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 5:34 PM Subject: [PHP-DB] mysql_fetch_array limit? - more details I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5. In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT. According to the manual, TEXT will give me a maximum space of 65,536 bytes per field. I've entered text in this field in the amount of approximately 500 characters. I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: .. $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; ... What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. Another possibility is that the mysql_query() could be truncing the result. I've checked my data directly in MySQL, and all the characters are there in direct SELECTs. Can someone please help? I've checked all manuals and FAQs I can, but I can't figure out why I'm having this problem. It should not be happening at all. Is there some size limitation to the array created via mysql_fetch_array()? Is there some other function that will accomodate my data? Is there any custom code to handle my data correctly? Thanks, Paul Worthington [EMAIL PROTECTED] -- The views expressed here are those of the user, not necessarily those of Evolving Systems, Inc. -- 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
Re: [PHP-DB] mysql_fetch_array limit? - more details
What do you mean it uses 2? It does not. On Tue, 30 Jul 2002, Andrey Hristov wrote: Maybe it will help you but I've read that when using persistent connections PHP uses 2 on every request. So if in one moment you have 10 scripts,that use persistent connections, running you will have 20 connections used to the mysql. Regards, Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 5:34 PM Subject: [PHP-DB] mysql_fetch_array limit? - more details I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5. In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT. According to the manual, TEXT will give me a maximum space of 65,536 bytes per field. I've entered text in this field in the amount of approximately 500 characters. I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: .. $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; ... What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. Another possibility is that the mysql_query() could be truncing the result. I've checked my data directly in MySQL, and all the characters are there in direct SELECTs. Can someone please help? I've checked all manuals and FAQs I can, but I can't figure out why I'm having this problem. It should not be happening at all. Is there some size limitation to the array created via mysql_fetch_array()? Is there some other function that will accomodate my data? Is there any custom code to handle my data correctly? Thanks, Paul Worthington [EMAIL PROTECTED] -- The views expressed here are those of the user, not necessarily those of Evolving Systems, Inc. -- 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
Re: [PHP-DB] mysql_fetch_array limit? - more details
Hello, last week I read this article : http://phplens.com/lens/php-book/optimizing-debugging-php.php It is long one. Extract from it (look where is it and read around it): [snip] Overload on 40 connections When we pushed the benchmark to use 40 connections, the server overloaded with 35% failed requests. On further investigation, it was because the MySQL server persistent connects were failing because of Too Many Connections. The benchmark also demonstrates the lingering behavior of Apache child processes. Each PHP script uses 2 persistent connections, so at 40 connections, we should only be using at most 80 persistent connections, well below the default MySQL max_connections of 100. However Apache idle child processes are not assigned immediately to new requests due to latencies, keep-alives and other technical reasons; these lingering child processes held the remaining 20+ persistent connections that were the straws that broke the Camel's back. The Fix By switching to non-persistent database connections, we were able to fix this problem and obtained a result of 5.340 seconds. An alternative solution would have been to increase the MySQL max_connections parameter from the default of 100. [/snip] Andrey - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Andrey Hristov [EMAIL PROTECTED] Cc: Paul Worthington [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 7:59 PM Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details What do you mean it uses 2? It does not. On Tue, 30 Jul 2002, Andrey Hristov wrote: Maybe it will help you but I've read that when using persistent connections PHP uses 2 on every request. So if in one moment you have 10 scripts,that use persistent connections, running you will have 20 connections used to the mysql. Regards, Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 5:34 PM Subject: [PHP-DB] mysql_fetch_array limit? - more details I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5. In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT. According to the manual, TEXT will give me a maximum space of 65,536 bytes per field. I've entered text in this field in the amount of approximately 500 characters. I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: .. $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; ... What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. Another possibility is that the mysql_query() could be truncing the result. I've checked my data directly in MySQL, and all the characters are there in direct SELECTs. Can someone please help? I've checked all manuals and FAQs I can, but I can't figure out why I'm having this problem. It should not be happening at all. Is there some size limitation to the array created via mysql_fetch_array()? Is there some other function that will accomodate my data? Is there any custom code to handle my data correctly? Thanks, Paul Worthington [EMAIL PROTECTED] -- The views expressed here are those of the user, not necessarily those of Evolving Systems, Inc. -- 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
Re: [PHP-DB] mysql_fetch_array limit? - more details
The only reason it uses two is if the code using persistent connections connects with different credentials. ie. you have 2 different apps on the same server that connects as 2 different user ids and they are both using persistent connections. Eventually every httpd will have 2 connections. -R On Tue, 30 Jul 2002, Andrey Hristov wrote: Hello, last week I read this article : http://phplens.com/lens/php-book/optimizing-debugging-php.php It is long one. Extract from it (look where is it and read around it): [snip] Overload on 40 connections When we pushed the benchmark to use 40 connections, the server overloaded with 35% failed requests. On further investigation, it was because the MySQL server persistent connects were failing because of Too Many Connections. The benchmark also demonstrates the lingering behavior of Apache child processes. Each PHP script uses 2 persistent connections, so at 40 connections, we should only be using at most 80 persistent connections, well below the default MySQL max_connections of 100. However Apache idle child processes are not assigned immediately to new requests due to latencies, keep-alives and other technical reasons; these lingering child processes held the remaining 20+ persistent connections that were the straws that broke the Camel's back. The Fix By switching to non-persistent database connections, we were able to fix this problem and obtained a result of 5.340 seconds. An alternative solution would have been to increase the MySQL max_connections parameter from the default of 100. [/snip] Andrey - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Andrey Hristov [EMAIL PROTECTED] Cc: Paul Worthington [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 7:59 PM Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details What do you mean it uses 2? It does not. On Tue, 30 Jul 2002, Andrey Hristov wrote: Maybe it will help you but I've read that when using persistent connections PHP uses 2 on every request. So if in one moment you have 10 scripts,that use persistent connections, running you will have 20 connections used to the mysql. Regards, Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 5:34 PM Subject: [PHP-DB] mysql_fetch_array limit? - more details I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5. In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT. According to the manual, TEXT will give me a maximum space of 65,536 bytes per field. I've entered text in this field in the amount of approximately 500 characters. I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: .. $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; ... What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. Another possibility is that the mysql_query() could be truncing the result. I've checked my data directly in MySQL, and all the characters are there in direct SELECTs. Can someone please help? I've checked all manuals and FAQs I can, but I can't figure out why I'm having this problem. It should not be happening at all. Is there some size limitation to the array created via mysql_fetch_array()? Is there some other function that will accomodate my data? Is there any custom code to handle my data correctly? Thanks, Paul Worthington [EMAIL PROTECTED] -- The views expressed here are those of the user, not necessarily those of Evolving Systems, Inc. -- 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
Re: [PHP-DB] mysql_fetch_array limit? - more details
Yeaah! I am a fool. My biggest excuses. Sorry Rasmus and everyone else. Andrey - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Andrey Hristov [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 8:11 PM Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details The only reason it uses two is if the code using persistent connections connects with different credentials. ie. you have 2 different apps on the same server that connects as 2 different user ids and they are both using persistent connections. Eventually every httpd will have 2 connections. -R On Tue, 30 Jul 2002, Andrey Hristov wrote: Hello, last week I read this article : http://phplens.com/lens/php-book/optimizing-debugging-php.php It is long one. Extract from it (look where is it and read around it): [snip] Overload on 40 connections When we pushed the benchmark to use 40 connections, the server overloaded with 35% failed requests. On further investigation, it was because the MySQL server persistent connects were failing because of Too Many Connections. The benchmark also demonstrates the lingering behavior of Apache child processes. Each PHP script uses 2 persistent connections, so at 40 connections, we should only be using at most 80 persistent connections, well below the default MySQL max_connections of 100. However Apache idle child processes are not assigned immediately to new requests due to latencies, keep-alives and other technical reasons; these lingering child processes held the remaining 20+ persistent connections that were the straws that broke the Camel's back. The Fix By switching to non-persistent database connections, we were able to fix this problem and obtained a result of 5.340 seconds. An alternative solution would have been to increase the MySQL max_connections parameter from the default of 100. [/snip] Andrey - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Andrey Hristov [EMAIL PROTECTED] Cc: Paul Worthington [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 7:59 PM Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details What do you mean it uses 2? It does not. On Tue, 30 Jul 2002, Andrey Hristov wrote: Maybe it will help you but I've read that when using persistent connections PHP uses 2 on every request. So if in one moment you have 10 scripts,that use persistent connections, running you will have 20 connections used to the mysql. Regards, Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 5:34 PM Subject: [PHP-DB] mysql_fetch_array limit? - more details I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5. In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT. According to the manual, TEXT will give me a maximum space of 65,536 bytes per field. I've entered text in this field in the amount of approximately 500 characters. I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: .. $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; ... What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. Another possibility is that the mysql_query() could be truncing the result. I've checked my data directly in MySQL, and all the characters are there in direct SELECTs. Can someone please help? I've checked all manuals and FAQs I can, but I can't figure out why I'm having this problem. It should not be happening at all. Is there some size limitation to the array created via mysql_fetch_array()? Is there some other function that will accomodate my data? Is there any custom code to handle my data correctly? Thanks, Paul Worthington [EMAIL PROTECTED] -- The views expressed here are those of the user, not necessarily those of Evolving Systems, Inc
RE: [PHP-DB] mysql_fetch_array limit? - more details
-Original Message- From: Paul Worthington [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 9:34 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] mysql_fetch_array limit? - more details What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. I'm a little curious about this assumption, given that I know I've successfully used mysql_query() and mysql_fetch_array() on pieces of data much bigger than that. Does echo strlen($myrow[txtSWDesc1]); produce the output you'd expect? --- Mark Roedel | There is only one truly satisfying way Systems Programmer| to boot a computer. LeTourneau University | Longview, Texas USA | -- J.H.Goldfuss -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql_fetch_array limit? - more details
I use mysql_fetch array to retrieve large text data many many times without a problem. I've actually written functions to retrieve the data for me using this function, and I never had a single problem, truncated or speed, on Unix, Linux or Windows platform. Check out the code for the functions getrow(), getrows(), they use mysql_fetch array. http://zc8.com/zc8/samplecode/sqltools.phps This is the explanations of the functions: http://zc8.net/zc8/shownews.php?articleid=98 You can use those as you please if you want On Tue, 30 Jul 2002, Paul Worthington wrote: No I don't have PhpMyAdmin installed. I work directly in MySQL via a terminal, so all my checking is with native calls anyway. Working natively in MySQL, all my data is there and everything works the way I expect it to. Using mysql_fetch_array() in PHP results in a truncated result set. And I am trying to figure out why, and how I can work around this problem. Thanks again, Paul Worthington [EMAIL PROTECTED] Andrey Hristov [EMAIL PROTECTED] wrote in message 01ed01c237ea$0d0fcf10$1601a8c0@nik">news:01ed01c237ea$0d0fcf10$1601a8c0@nik... Do you have PhpMyAdmin installed? If you have try with it to see the results. It uses native mysql functions. Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 7:53 PM Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details Thank you for that idea. I don't think that's it, though, because this script is the only one I'm ever running on this site. The problem is perfectly consistent and repeatable, which leads me to believe it's something in the way the array is being built. Paul Worthington [EMAIL PROTECTED] Andrey Hristov [EMAIL PROTECTED] wrote in message 01cd01c237e8$7e1438b0$1601a8c0@nik">news:01cd01c237e8$7e1438b0$1601a8c0@nik... Maybe it will help you but I've read that when using persistent connections PHP uses 2 on every request. So if in one moment you have 10 scripts,that use persistent connections, running you will have 20 connections used to the mysql. Regards, Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 5:34 PM Subject: [PHP-DB] mysql_fetch_array limit? - more details I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5. In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT. According to the manual, TEXT will give me a maximum space of 65,536 bytes per field. I've entered text in this field in the amount of approximately 500 characters. I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: .. $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; ... What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. Another possibility is that the mysql_query() could be truncing the result. I've checked my data directly in MySQL, and all the characters are there in direct SELECTs. Can someone please help? I've checked all manuals and FAQs I can, but I can't figure out why I'm having this problem. It should not be happening at all. Is there some size limitation to the array created via mysql_fetch_array()? Is there some other function that will accomodate my data? Is there any custom code to handle my data correctly? Thanks, Paul Worthington [EMAIL PROTECTED] -- The views expressed here are those of the user, not necessarily those of Evolving Systems, Inc. -- 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 Datab
RE: [PHP-DB] mysql_fetch_array limit? - more details
One thing I haven't seen yet is a cut-n-paste of your db tables. Could you post that to this list? Maybe there's something you're overlooking there? Maybe seomebody will find something amiss there. I know it sounds simple and you might think you have it all down right, but how many times have you been nagged for something stupid like forgetting the ; at the end of a query or PHP statement? Just a thought. -Original Message- From: Paul Worthington [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 10:34 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] mysql_fetch_array limit? - more details I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5. In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT. According to the manual, TEXT will give me a maximum space of 65,536 bytes per field. I've entered text in this field in the amount of approximately 500 characters. I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: .. $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; ... What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. Another possibility is that the mysql_query() could be truncing the result. I've checked my data directly in MySQL, and all the characters are there in direct SELECTs. Can someone please help? I've checked all manuals and FAQs I can, but I can't figure out why I'm having this problem. It should not be happening at all. Is there some size limitation to the array created via mysql_fetch_array()? Is there some other function that will accomodate my data? Is there any custom code to handle my data correctly? Thanks, Paul Worthington [EMAIL PROTECTED] -- The views expressed here are those of the user, not necessarily those of Evolving Systems, Inc. -- 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
Re: [PHP-DB] mysql_fetch_array limit? - more details
on 7/30/02 10:34 AM, Paul Worthington at [EMAIL PROTECTED] appended the following bits to my mbox: I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: . ... $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; . What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in Are you sure that the printf() function can take more than 256 characters of input? Since you are only outputting strings, printf isn't really necessary so you can use the echo command instead. Also, though this probably isn't the reason, you should quote your key names. while ($myrow = mysql_fetch_array($result)) { echo 'trtd',$myrow['Name'],'/td'; echo 'td',$myrow['txtSWDesc1'],'/td/tr'; } HTH. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql_fetch_array limit? - more details
I am a bonehead. In stripping down my code for posting here, the problem suddenly went away. I was building a temporary table and all this time I've been overlooking the fact that my txtSWDesc1 field in the tmp table was set to 255. My apologies to everyone. And thanks for trying to help me. Paul Mark A. Roedel [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... -Original Message- From: Paul Worthington [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 9:34 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] mysql_fetch_array limit? - more details What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. I'm a little curious about this assumption, given that I know I've successfully used mysql_query() and mysql_fetch_array() on pieces of data much bigger than that. Does echo strlen($myrow[txtSWDesc1]); produce the output you'd expect? --- Mark Roedel | There is only one truly satisfying way Systems Programmer| to boot a computer. LeTourneau University | Longview, Texas USA | -- J.H.Goldfuss -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql_fetch_array limit? - more details
My mistake: I was setting the limit myself via an incorrect column definition whilst creating a temporary table. I feel so stupid. Thanks for trying to help me. Paul Kodrik [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I use mysql_fetch array to retrieve large text data many many times without a problem. I've actually written functions to retrieve the data for me using this function, and I never had a single problem, truncated or speed, on Unix, Linux or Windows platform. Check out the code for the functions getrow(), getrows(), they use mysql_fetch array. http://zc8.com/zc8/samplecode/sqltools.phps This is the explanations of the functions: http://zc8.net/zc8/shownews.php?articleid=98 You can use those as you please if you want On Tue, 30 Jul 2002, Paul Worthington wrote: No I don't have PhpMyAdmin installed. I work directly in MySQL via a terminal, so all my checking is with native calls anyway. Working natively in MySQL, all my data is there and everything works the way I expect it to. Using mysql_fetch_array() in PHP results in a truncated result set. And I am trying to figure out why, and how I can work around this problem. Thanks again, Paul Worthington [EMAIL PROTECTED] Andrey Hristov [EMAIL PROTECTED] wrote in message 01ed01c237ea$0d0fcf10$1601a8c0@nik">news:01ed01c237ea$0d0fcf10$1601a8c0@nik... Do you have PhpMyAdmin installed? If you have try with it to see the results. It uses native mysql functions. Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 7:53 PM Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details Thank you for that idea. I don't think that's it, though, because this script is the only one I'm ever running on this site. The problem is perfectly consistent and repeatable, which leads me to believe it's something in the way the array is being built. Paul Worthington [EMAIL PROTECTED] Andrey Hristov [EMAIL PROTECTED] wrote in message 01cd01c237e8$7e1438b0$1601a8c0@nik">news:01cd01c237e8$7e1438b0$1601a8c0@nik... Maybe it will help you but I've read that when using persistent connections PHP uses 2 on every request. So if in one moment you have 10 scripts,that use persistent connections, running you will have 20 connections used to the mysql. Regards, Andrey - Original Message - From: Paul Worthington [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 5:34 PM Subject: [PHP-DB] mysql_fetch_array limit? - more details I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5. In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT. According to the manual, TEXT will give me a maximum space of 65,536 bytes per field. I've entered text in this field in the amount of approximately 500 characters. I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: .. $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; ... What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. Another possibility is that the mysql_query() could be truncing the result. I've checked my data directly in MySQL, and all the characters are there in direct SELECTs. Can someone please help? I've checked all manuals and FAQs I can, but I can't figure out why I'm having this problem. It should not be happening at all. Is there some size limitation to the array created via mysql_fetch_array()? Is there some other function that will accomodate my data? Is there any custom code to handle my data correctly? Thanks, Paul Worthington [EMAIL PROTECTED] -- The views expressed here are those of the user, not necessarily those of Evolving Systems, Inc.
Re: [PHP-DB] mysql_fetch_array limit? - more details
Problem solved. I was stupidly overlooking an incorrect column definition in a temporary table. Everything's fine now. Thank you so much for trying to help me, and please excuse my errors. Paul Richard Hutchins [EMAIL PROTECTED] wrote in message 1EA7D3AE70ACD511BE6D006097A78C1E022BF618@USROCEXC">news:1EA7D3AE70ACD511BE6D006097A78C1E022BF618@USROCEXC... One thing I haven't seen yet is a cut-n-paste of your db tables. Could you post that to this list? Maybe there's something you're overlooking there? Maybe seomebody will find something amiss there. I know it sounds simple and you might think you have it all down right, but how many times have you been nagged for something stupid like forgetting the ; at the end of a query or PHP statement? Just a thought. -Original Message- From: Paul Worthington [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 10:34 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] mysql_fetch_array limit? - more details I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5. In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT. According to the manual, TEXT will give me a maximum space of 65,536 bytes per field. I've entered text in this field in the amount of approximately 500 characters. I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: .. $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; ... What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in mysql_fetch_array(), that it must have some size limitation that truncates whatever data it has read to exactly 256 chars. Another possibility is that the mysql_query() could be truncing the result. I've checked my data directly in MySQL, and all the characters are there in direct SELECTs. Can someone please help? I've checked all manuals and FAQs I can, but I can't figure out why I'm having this problem. It should not be happening at all. Is there some size limitation to the array created via mysql_fetch_array()? Is there some other function that will accomodate my data? Is there any custom code to handle my data correctly? Thanks, Paul Worthington [EMAIL PROTECTED] -- The views expressed here are those of the user, not necessarily those of Evolving Systems, Inc. -- 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
Re: [PHP-DB] mysql_fetch_array limit? - more details
Thanks for all your helpful suggestions. It turns out I was limiting the array myself by setting a temporary table column definition to varchar(255). I have been overlooking it all this time. I feel so stupid. Thanks again for trying to help me. Paul Paul Burney [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... on 7/30/02 10:34 AM, Paul Worthington at [EMAIL PROTECTED] appended the following bits to my mbox: I'm using this PHP code, very simple and straightforward, to select two columns into an array and then display the results in an HTML table: . ... $db = mysql_connect(localhost, user1); mysql_select_db(testdb,$db); $sql = SELECT * FROM tmp ORDER BY Name; $result = mysql_query($sql,$db); echo TABLE\n; echo TR\nTHPlace Name/TH\nTHDescription/TH\n/TR\n; while ($myrow = mysql_fetch_array($result)) { printf(TRTD%s/TDTD%s/TD/TR\n, $myrow[Name], $myrow[txtSWDesc1]); } echo /TABLE\n; . What happens is I'm only getting the first 256 characters of txtSWDesc1 displayed in my table. I am assuming the problem is in Are you sure that the printf() function can take more than 256 characters of input? Since you are only outputting strings, printf isn't really necessary so you can use the echo command instead. Also, though this probably isn't the reason, you should quote your key names. while ($myrow = mysql_fetch_array($result)) { echo 'trtd',$myrow['Name'],'/td'; echo 'td',$myrow['txtSWDesc1'],'/td/tr'; } HTH. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php