Just now I am working with a problem where I need to update a column/field by appending something. I was in a bit trouble for a 2 mins as I was finding a solution for this. First thing came to my mind is
UPDATE `table_name` SET `field_name`=`field_name`+’appending string’ WHERE `field_name`=’xxx’;
I knew this won’t work in my case. It is suitable when I need to SUM up floating point. However, I simply need to append to current value. Within two mins I got the idea that worked 100%. It is:
UPDATE `table_name` SET `field_name`=concat(`field_name`, ‘ appending string’) WHERE `field_name`=’xxx’;
If you are looking for creating PDF output of your HTML pages, you can do it using PHP’s PDFlib module. However, there are some libraries for faster development of your script. Some even are not dependent on PDFlib. Please see below for quick overview.
dompdf is an HTML to PDF converter. At its heart, dompdf is (mostly) CSS2.1 compliant HTML layout and rendering engine written in PHP. It is a style-driven renderer: it will download and read external stylesheets, inline style tags, and the style attributes of individual HTML elements. It also supports most presentational HTML attributes.
* handles most CSS2.1 properties, including @import, @media & @page rules
* supports most presentational HTML 4.0 attributes
* supports external stylesheets, either local or through http/ftp (via fopen-wrappers)
* supports complex tables, including row & column spans, separate & collapsed border models, individual cell styling, (no nested tables yet however)
* image support (gif, png & jpeg)
* no dependencies on external PDF libraries, thanks to the R&OS PDF class
* inline PHP support. See below for details. Continue reading →
Today I was wondering how can I concatenate multiple rows in a single row. Suppose, I need to get the email addresses of a user table. The “SELECT `email` FROM `usertable`;” will return something like this:
But I needed:
email1, email2, email3
It is very easy to process and make same output using PHP. But I thought there must be a way in MySQL. After searching a while I got the solution. Its simple.
Last two days, I am playing or learning to play with nginx web server. I have heard some reputation about it and saw some performance chart in the web. I liked it for its, as claimed, extremely low memory footprint for one of my small VPS.
After reading some tutorial in Projanmo Forum, I am successfully configured nginx, with with fastcgi, php-fpm, mysql etc. When I visit the website, I found some problems. Some section were not working. Later I found, where I used $_SERVER['PHP_SELF'] were not not working. Later investigating the phpinfo(); I have seen that some global php variables are empty. I found nothing on net. Later alamgir bro, helped to sort out. In fact the whole tutorial is contributed by him.
Solving this issue is real easy. Just add the following the in your nginx php configuration section.
The changed codes may look like: [copied directly from his mail]
Today, I have to waste a long time with new server. Last night my internet connection disconnected while cPanel was installing in the server. Later I have seen that everything running fine except mysql. It is showing some error like:
Warning, no valid mysql.sock file found.mysql has failed
searching many tutorials, forums after 2/3 hours later I found the following post. http://forums.spry.com/showpost.php?s=06fff7fc89bd04e88fbdf1ecf60f4be1&p=2055&postcount=6 Continue reading →