[PHP-DB] Help With An UPDATE Query Please
Hi, How can I update a column where the first letter begins with 'M' and adjust it so that column ends with 'M' instead. So something like 'UPDATE table SET column = 'xxxM' WHERE column = 'Mxxx'. I hope this explains what I am trying to achieve! Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help With An UPDATE Query Please
UPDATE table SET column = CONCAT( MID( column, 2, LENGTH( column ) - 1 ), MID( column, 1, 1 ) ) WHERE column LIKE 'M%' HTH Ignatius _ - Original Message - From: Shaun [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 10, 2004 14:15 Subject: [PHP-DB] Help With An UPDATE Query Please Hi, How can I update a column where the first letter begins with 'M' and adjust it so that column ends with 'M' instead. So something like 'UPDATE table SET column = 'xxxM' WHERE column = 'Mxxx'. I hope this explains what I am trying to achieve! Thanks -- 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] msql perfomance: fast through mysql, slow through php
There are couple of things that look like they may be slowing you down. The first one being the east coast/west coast thing. There's a big possibility for latency issues going that distance no matter how fast your connection is. You can do a quick test using ping. You're also writing out to screen as you get the data, so you may be adding the latency from the web server to the client on top of your data fetching. You can probably get a boost by getting all the data into PHP first and then formatting and sending it to the client. At a minimum you should be able to determine if the client is the big slow down. This is the standard code (simplified a bit) I use for getting data from MySQL. $query = select acolumn from atable where bcolumn=0; $result = mysql_query($query,$db); if($result) { $num_rows = mysql_num_rows($result); while ($row = mysql_fetch_array ($result,MYSQL_ASSOC)) { $result_arr[] = $row; } } Now all your data is being held by PHP in the array variable $result_arr, MySQL is out of the picture and the client is not yet part of the picture. You then cycle through the array, formatting the output for the client. Ideally, you would also use output buffering in PHP and then deliver the final formatted output in one big chunk to the client rather than streaming it a little bit at a time. And if you are using output buffering, you can then using compression to deliver the data to the client for an even bigger speed boost, especially if the client is connected over a modem. Look into ob_start(ob_gzhandler) for details on using output buffering. Hope some of those suggestions speed things up. On Feb 8, 2004, at 10:47 PM, jde wrote: Greetings, I have search the archives over the last two years and have not found any help for this question. The basic setup: An apache/php server exists on the west coast of the US, and a linux/mysql server on the east coast. My PHP snippet looks like this: $result = mysql_query(select acolumn from atable where bcolumn=0, $db); while ($row = mysql_fetch_assoc($result)) echo 'some stuff from the row'; The problem is, that the above snippet, to return seven rows, takes about 15 seconds. Putting timing statements around the query and around the fetch calls shows that the query call takes only 0.03 seconds. However, each fetch call takes anywhere from 0.5 to 5 seconds each to complete. However, if I am logged onto the apacher server and from the user prompt run the 'mysql' client, and perform the same exact query, the 'mysql' client can peform the query and return all the results, all 7 rows, in 0.1 second. This is apache 1.3/php 4.3.4 and mysql 4.0.17-standard. I have tried all the mysql_connect flags without any change. Should I expect such a performance difference? Is there something else I need to look for? Thank you for your time, jde -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] msql perfomance: fast through mysql, slow through php
Hi jde, this sounds very strange. Please post send the results of an traceroute and ping to the list. Perhaps, the bandwidth could be the problem. We have a constellation like you with our boxes in germany. The webservers are located in karslruhe, the mysql-boxes in frankfurt. Everything works fine... Regards, Sebastian jde said: Greetings, I have search the archives over the last two years and have not found any help for this question. The basic setup: An apache/php server exists on the west coast of the US, and a linux/mysql server on the east coast. My PHP snippet looks like this: $result = mysql_query(select acolumn from atable where bcolumn=0, $db); while ($row = mysql_fetch_assoc($result)) echo 'some stuff from the row'; The problem is, that the above snippet, to return seven rows, takes about 15 seconds. Putting timing statements around the query and around the fetch calls shows that the query call takes only 0.03 seconds. However, each fetch call takes anywhere from 0.5 to 5 seconds each to complete. However, if I am logged onto the apacher server and from the user prompt run the 'mysql' client, and perform the same exact query, the 'mysql' client can peform the query and return all the results, all 7 rows, in 0.1 second. This is apache 1.3/php 4.3.4 and mysql 4.0.17-standard. I have tried all the mysql_connect flags without any change. Should I expect such a performance difference? Is there something else I need to look for? Thank you for your time, jde -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Sebastian Mangelkramer IMAC - Information Management Consulting Blarerstraße 56, D-78462 Konstanz Tel. +49 (0)7531 - 90 39-11 Fax +49 (0)7531 - 90 39-47 E-Mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP / mysql / opendb / Apache
I am trying to get a functioning instance of these components working on my Solaris 2.8 box. Are there any comprehensive instructions out there to achieve this? Thanks Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Compatibility between Sybase and PHP
Hi, I found that there is a problem in the version compatibility between our Sybase server and PHP/apache server. PHP can retrieve data from Sybase but get core dump when exit from sybase call. This seems to happen in several version of freetds and php. Has anyone encountered such problem before and found out a solution to it? Any help will be very much appreciated. -- Have a nice day! Regards, Alan Chan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: mktime question
http://www.mysql.com/documentation/mysql/bychapter/manual_Functions.html#IDX1342 insert into tbl (timeCol) values (now()) when you retrieve the time from mySQL, you format it the way you want and then display it !!! http://www.mysql.com/documentation/mysql/bychapter/manual_Functions.html#IDX1357 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Missing mysql_real_escape_string() function in PHP 4.3.4
I'm trying to move a PHP application that was originally built on the windows PHP implementation to a newly installed Fedora FC1 Linux system. However the Fedora implementation of PHP 4.3.4 seems to be missing the mysql_real_escape_string() function. I suspect that there might be other mysql functions missing as well - so I would appreciate your advice on how to get this new system up to speed with all of the latest PHP 4.3.x extensions. Thanks! (this signature is in HTML format) uuu R a d iS h o u r b a j i Product Management w Project Management w Software Marketing http://www.radi-shourbaji.blogspot.com/ ResumeBlogT | mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] | (408) 441-7234
[PHP-DB] RE: [PHP] Missing mysql_real_escape_string() function in PHP 4.3.4
[snip] I'm trying to move a PHP application that was originally built on the windows PHP implementation to a newly installed Fedora FC1 Linux system. However the Fedora implementation of PHP 4.3.4 seems to be missing the mysql_real_escape_string() function. I suspect that there might be other mysql functions missing as well - so I would appreciate your advice on how to get this new system up to speed with all of the latest PHP 4.3.x extensions. [/snip] Here are all of the available mysql functions, each has its version listed on the appropropriate page. http://us4.php.net/manual/en/ref.mysql.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php