If you spend any time surfing the Internet, you’ve probably encountered a few error messages. Error messages have numerous causes, such as misspellings, outdated links or internal server errors. When an error is encountered, your server will display specific generic error pages according to the error. These error pages are not only dead ends, but [...]
Archive for July, 2009
Export the mysql data into excel sheet (CSV format)
Using this php code you can export the mysql data into excel sheet before that while starting we need to create a blank file in csv format, because then only you can perfectly export the data into to sheet later we would save the file as excel format. <?php $conn = mysql_connect(“localhost”,”root”,””); mysql_select_db(“dbname”,$conn); $filename = [...]
Rainbow text is the camel toe of the net
If the tag cloud is the mullet of the internet, then rainbow text is the camel toe of the net. Ghastly to look at, but you just can’t take your eyes from it. There are many variations on how to produce rainbow text. This method employs a simple array of color values and applies them [...]
Reading line from file
Reading files in PHP can be a tricky business if not handled correctly. Most often when confronted with reading a line from, the nearest tool to hand is the file() function. The problem with using the file() function is that it reads the whole file into an array, and thus, into memory. Any subsequent operations [...]
How to check if a file exists within a directory, or sub directory of the parent?
How to check if a file exists within a directory, or sub directory of the parent. With the use of the PHP SPL recursiveDirectoryIterator this is quite simple. Care should be taken that if any sub directory within the specified directory to search does not have adequate permissions, the function will return false. Use this [...]
Generate a unicode table
Ever needed to generate a Unicode table? How it might be done, here is one of a many possibilities <table style=”border:1px solid black;”> <tr><th> </th><th>0</th> <th>1</th><th>2</th th>3</th><th>4</th> <th>5</th><th>6</th> <th>7</th><th>8</th> <th>9</th><th>A</th> <th>B</th><th>C</th> <th>D</th><th>E</th> <th>F</th></tr> <?php /*** from zero to 256 ***/ for ($i=0; $i<256; $i++) { printf(‘<tr><td style=”border:solid 1px black;”>%04X</td>’, $i); for ($j=0; $j<16; $j++) { [...]
Relative to the web server document root
You having default PHP functions to get the web server document within the $_SERVER super global array, and for getting the current working directory with the getcwd() function. But it often occurs that the document is being served from another directory within the web tree. This function will get the current working directory, relative to [...]
Remove special characters except white spaces
Below code will remove all special charaters except white spaces, For example, is we input a string “Hello vijaya#$%kumar&%”, it will returns string as “Hello vijayakumar”. I hope it will useful for some programmers, easy to implement. Try this and comment. <?php function alphanumericAndSpace( $string ) { return preg_replace(‘/[^a-zA-Z0-9\s]/’, ”, $string); } ?>



Posted in
Tags: