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 →

Display all field (column) names of a table in MySQL database

I mentioned before in my previous post Display data from MySQL with PHP which I demonstrated how to display the data of a row within a table, now I want to demonstrate how to display and print out all field names (column names) of a table within a MySQL database. Continue Reading →

  • Categories

  • Useful Downloads