Re: [PHP-DB] Headers sent error msg on one server but not the other...... .
Martin Norland wrote: Personally I disagree with this. Yes it's easy, but you should never enable a feature to fix a bug or problem when it can be tracked down (although obviously in time critical situations, using it as a 'band aid' is - sometimes - necessary). With a quick pointer he was able to find it, and not impact the performance of his web server (output buffering will take more memory - since it's obviously buffering all the output) More importantly though, with output buffering - no content is sent to the client until you flush - in your suggestion at the end. This isn't always an issue since many scripts do much of their processing at the top anyway, but if nothing is sent to the browser - the users will (the majority of the time) see the page they were on, and continue interacting with it thinking their request didn't go through. This will only increase load on your server and, depending on what the users are doing (and how your backend is written) could throw someone or something into a state of confusion. cheers, -- Ok, then you must find those characters that are sent before you modify the header. Commonly are spaces or returns. In the error HEADER ALREADY SENT .. also appears the line number that started the output. I hope this can be useful. I hope you can find those characters. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] chat
Does anyone know where there is a good chat room with PHP developers? -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.0 - Release Date: 4/29/2005
Re: [PHP-DB] Memory
Am Mi, den 27.04.2005 schrieb [FOTOList.com] Suporte um 15:46: Hi, When I get something from database, using this function: pg_query (postgresql) or mysql_query and after put this result in somes variables, Am I using double memory to same data or this new variable point to variable with db result? A normal mysql_query or mysqli_query function allocates a char** pointer (in libmysql) for all data in resultset until it's freed via mysql_free_result. If you have to retrieve a large amount of data (and you don't use nested selects) you should use mysql_unbuffered_query instead. This method can be also faster. /Georg -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Mysql: LOCK TABLES
Hi, I've got question on using LOCK TABLES with MySQL and PHP. I don't have a great understanding of LOCK TABLES, but I'll lay out my situation: I've got a table and a PHP function to rebuild several columns in this table. I need to read these columns from the database (all of them) and recalculate the proper values, then UPDATE the rows with the new values. So, two queries, a read query, then a write query. This is a recurisve function in PHP, so it can't be done in one MySQL query unfortunately. I need to keep the values of these columns from changing in-between the read and write queries. As I understand it this is exactly what a WRITE lock is for. Now, to my question. What does my PHP function see if it goes to lock a table, and fails? Does the query itself fail, requiring me to Loop+sleep my application until it doesn't? Or does mysqli_query() not return until it has successfully locked the table? If it's one of these, can I force it to act like the other? Another thing, This table could possibly get *huge* in the future, if so I would probably need to loop through the results of the read query and RUN the UPDATEs as soon as my PHP app knows it to save on memory usage. Thanks in advance, Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql_data_seek problem
Just add a check of the total returned rows, and seek to 0 only if there is 1 or more. if(mysql_num_rows($rResult) 1) mysql_data_seek($rResult,0); Chris Alvaro Cobo wrote: Hi all: I am having problems with the function mysql_data_seek when it refers to an array with an empty recordset (for example when the query does not returns data), so I keep receiving the following message in the browser: Warning: mysql_data_seek(): Offset 0 is invalid for MySQL result index 9 (or the query data is unbuffered) in /var/www/intranet/inform/view.php on line 146 I need this function to reset an array to use the same query several times in the same page. Does anybody knows how to avoid this message to be printed? Thanks a lot. Alvaro -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql_data_seek problem
Sorry, two typos, that should; have been: if(mysql_num_rows($rResult) 0)) mysql_data_seek($rResult,0); Chris wrote: Just add a check of the total returned rows, and seek to 0 only if there is 1 or more. if(mysql_num_rows($rResult) 1) mysql_data_seek($rResult,0); Chris Alvaro Cobo wrote: Hi all: I am having problems with the function mysql_data_seek when it refers to an array with an empty recordset (for example when the query does not returns data), so I keep receiving the following message in the browser: Warning: mysql_data_seek(): Offset 0 is invalid for MySQL result index 9 (or the query data is unbuffered) in /var/www/intranet/inform/view.php on line 146 I need this function to reset an array to use the same query several times in the same page. Does anybody knows how to avoid this message to be printed? Thanks a lot. Alvaro -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Mysql: LOCK TABLES
At 09:01 PM 5/1/2005, Chris wrote: Hi, I've got question on using LOCK TABLES with MySQL and PHP. I don't have a great understanding of LOCK TABLES, but I'll lay out my situation: I've got a table and a PHP function to rebuild several columns in this table. I need to read these columns from the database (all of them) and recalculate the proper values, then UPDATE the rows with the new values. So, two queries, a read query, then a write query. This is a recurisve function in PHP, so it can't be done in one MySQL query unfortunately. I need to keep the values of these columns from changing in-between the read and write queries. As I understand it this is exactly what a WRITE lock is for. Now, to my question. What does my PHP function see if it goes to lock a table, and fails? Does the query itself fail, requiring me to Loop+sleep my application until it doesn't? Or does mysqli_query() not return until it has successfully locked the table? If it's one of these, can I force it to act like the other? Another thing, This table could possibly get *huge* in the future, if so I would probably need to loop through the results of the read query and RUN the UPDATEs as soon as my PHP app knows it to save on memory usage. Thanks in advance, Chris Chris, So your user LOCKS the table and then power fails, browser crashes, someone else tries to run same function ... etc. MySQL is so fast on indexed queries, are you certain this is information that has to be calculated and stored, rather than fetched and displayed? Of course you've not described the data or the calculation, so my question may be out of line. Generally speaking, though, it's not a good idea to lock either rows or tables in Internet apps. Regards - Miles Thompson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] chat
IRC - #PHP On Sunday 01 May 2005 06:22 am, Patrick Dunegan wrote: Does anyone know where there is a good chat room with PHP developers? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Mysql: LOCK TABLES
Miles Thompson wrote: At 09:01 PM 5/1/2005, Chris wrote: Hi, I've got question on using LOCK TABLES with MySQL and PHP. I don't have a great understanding of LOCK TABLES, but I'll lay out my situation: I've got a table and a PHP function to rebuild several columns in this table. I need to read these columns from the database (all of them) and recalculate the proper values, then UPDATE the rows with the new values. So, two queries, a read query, then a write query. This is a recurisve function in PHP, so it can't be done in one MySQL query unfortunately. I need to keep the values of these columns from changing in-between the read and write queries. As I understand it this is exactly what a WRITE lock is for. Now, to my question. What does my PHP function see if it goes to lock a table, and fails? Does the query itself fail, requiring me to Loop+sleep my application until it doesn't? Or does mysqli_query() not return until it has successfully locked the table? If it's one of these, can I force it to act like the other? Another thing, This table could possibly get *huge* in the future, if so I would probably need to loop through the results of the read query and RUN the UPDATEs as soon as my PHP app knows it to save on memory usage. Thanks in advance, Chris Chris, So your user LOCKS the table and then power fails, browser crashes, someone else tries to run same function ... etc. MySQL is so fast on indexed queries, are you certain this is information that has to be calculated and stored, rather than fetched and displayed? Of course you've not described the data or the calculation, so my question may be out of line. Generally speaking, though, it's not a good idea to lock either rows or tables in Internet apps. Regards - Miles Thompson This is a Modified Pre-Order Tree traversal.. So I have a Left value, a Right value and a Parent ID value. The Left and Right numbers are mutually unique and used to define a parent-child relationship (and order as well). The function is a 'corruption recovery' function. If the left-right values have duplicates or gaps certain aspects of my app don't work properly. So I need to be able to 'Rebuild' the tree. This rebuilding is recursive and, as far as I know, impossible to do in a query. So I need to read the tree from the database as best I can, then reassign valid values to the 3 fields. If, by chance, it *is* possible to do it in one query, I'd jump on it. As far as I could tell from the MySQL docs, The LOCK would unlock when the connection dropped (if the user hits cancel, or server crashes it would drop); If the server drops uncleanly I've probably got a lot more things to worry about than a tree structure being invalid Chris I -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] String manipulation
Hi there everyone, I'm working with a mysql Db where I have a single string that I have to split into 2 strings, the first character is the first name and I have that split off into it's own variable, but what I need to know is what's the best method to read the string again BUT ignore the first letter as that is already copied into $firstname? So basically I have $firstname defined from the one string, but I have to define $lastname from the SAME string value as the one I used for $firstname, BUT ignoring the first letter but I'm not sure what the best method is to achieve this? Any help would be very appreciated. Chris
[PHP-DB] Re: String manipulation
http://www.php.net/manual/en/function.substr.php Full String Documentation http://www.php.net/manual/en/ref.strings.php Regards, Nadim Hi there everyone, I'm working with a mysql Db where I have a single string that I have to split into 2 strings, the first character is the first name and I have that split off into it's own variable, but what I need to know is what's the best method to read the string again BUT ignore the first letter as that is already copied into $firstname? So basically I have $firstname defined from the one string, but I have to define $lastname from the SAME string value as the one I used for $firstname, BUT ignoring the first letter but I'm not sure what the best method is to achieve this? Any help would be very appreciated. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php