How to change the storage engine of a MySQL table
This post will show you how to change a storage engine of a MySQL table to another engine.
1) For SQLYog software users:
select a table you want to change the storage engine, then click on Table tab, select Alter Table. Then click on Advanced Properties. You will see a dialog box as seen below, select Table type drop down box, and select an engine you wish for that specific table.
2) For PHPMyAdmin users:
select database, select a table that you want to change the engine. Then click on Operations tab, you will see the Table Options panel. Select the Storage Engine dropdown box, now you can select the engine type you want for that table.
3) For MySQL command users:
if you wish to change the “customers” table from MyISAM to INNODB, select the database, select the table, then run this SQL query againt the table:
ALTER TABLE customers ENGINE = innodb;
Remember that the storage engine type is not case sensitive.
Multilined String in PHP
Multilined string in PHP can be written in many different ways to have your codes look clean and neat.
Method 1: You can break the lines into multiple strings on multiple lines using a period in front of the assignment sign in order to concatenate them.
Usage:
$st = “This is the book”;
$st .= ” that I really like to read in my spare time.”;
$st .= ” I bring it with me while I’m traveling this summer.”;
Method 2: Use excerpt sign and close it at the end of all the lines. You must write exact same name as you previously defined it.
Usage:
$st = <<<STOPHERE
<p>This is the book
that I really like to read in my spare time. I bring it with me while I’m traveling this summer.</p>
STOPHERE;
Find the location of a file
__FILE__ is a built-in php global variable that you can use to get the location of a file that’s executing.
Usage: echo __FILE__;
Result (Linux): /var/www/html/my-domain.com/TestDir/setExpiredDate.php
(Windows): C:\Documents and Settings\myname\My Documents\www\TestDir\setExpiredDate.php
Using backslash when echo quotation marks
Sometimes you’ll see quotation marks in a string that represent exact language that has come from somebody else. The quotation mark is also used to designate speech acts in fiction and poetry. For example: Mr. Douglas, who was working in his field that morning, said, “The alien spaceship appeared right before my own eyes.”
In this case, if you want to echo this string out on a php page, you will have to add a backslash in front of each quotation mark to ensure that it will appear on the html page.
echo "<P>
Mr. Douglas, who was working in his field that morning, said, \”The alien spaceship appeared right before my own eyes.\”</P>";
Apache Variables
After installing Apache and PHP server, you can check the Apache variables by using a php page to echo them on the browser. If you need to modify the Apache config to adapt your server environment and to meet your needs, you can always change the .conf file and restart your Apache server.
Use the Apache variables below to check your server:
DOCUMENT_ROOT | Document root |
HTTP_ACCEPT | Accept header of an HTTP request |
HTTP_ACCEPT_ENCODING | Accepted encoding (deflate or gzip) |
HTTP_ACCEPT_LANGUAGE | Accept-Language from HTTP header |
HTTP_CONNECTION | Connection header of the HTTP request |
HTTP_HOST | Internet host |
HTTP_USER_AGENT | Client initiating web request |
PATH | Directories the server looks |
REMOTE_ADDR | Address of the client |
REMOTE_PORT | Port of client |
SCRIPT_FILENAME | Absolute path of script |
SERVER_ADDR | Server’s address |
SERVER_ADMIN | Admin of server |
SERVER_NAME | Server name set |
SERVER_PORT | Port the web server is running on |
SERVER_SIGNATURE | Version of the server software |
SERVER_SOFTWARE | Server’s identification string, found in HTTP header |
GATEWAY_INTERFACE | Version of the CGI spec used |
SERVER_PROTOCOL | Protocol server is currently using |
REQUEST_METHOD | Request method, such as GET, PUT, POST, etc. |
QUERY_STRING | Query string if one exists |
REQUEST_URI | Uniform Resource Identifier |
SCRIPT_NAME | Path and name for the current script |
PATH_TRANSLATED | Absolute path on the web server’s file system |
PHP_SELF | Location of PHP script relative to document root |