PHPSuperBlog.com

Use PHP to change MySQL field size

In this example, I am going to show you how to use PHP to change a MySQL database’s field size.

I have created a MySQL database with a table called “test” and a field called “testing” size varchar(100).

I have created a PHP file called “changesize.php” and I would like to use it to change the field size from varchar(100) to varchar(200). Continue Reading →

Change the MySQL database table encoding to UTF8 with PHP

In some cases, where you forgot to change the MySQL database table encoding to UTF8 when creating but you need to insert some text such as Chinese or other Asian languages which require UTF8 into the MySQL. Also you might not have a MySQL user control interface such as phpmyadmin to make it easy for you, and so what should you do?? Let’s create a PHP file to do the job, and here is an example:
Continue Reading →

Insert all array elements into MySQL database table’s different fields

Array is a good way to store many elements, but in some operations you might like to store all of the elements in a array into different field of a table in a MySQL database. To store into different row, we can use a for loop to go through each elements and run a query to insert them 1 by 1 but insert into different fields is another story. Let me show you how in this example: Continue Reading →

Join all elements of an array together and become a string

In an array, there are many elements in it. But in some operations, you might like to join all the elements within an array to become a string and use the string for other use, how can this be done?? There is a function of PHP can do the job, which is implode( ). Let me show how to do so: Continue Reading →

  • Categories

  • Useful Downloads