Pixelconnect Web Design Blog
Import a CSV file to MySQL via phpMyAdmin
Since there were no articles around for this topic from searching google, I thought I would write a short article on helping you import a CSV file to Mysql via phpMyAdmin.
I had recieved a large excel sheet, some 16k rows and 20 columns large, and needed to transfer this to mysql for a postage calculation. Ill lead you through the steps to achieve this process.
- Name your columns appropriately in the Excel File
- Set up identical columns names in correct order in the MySQL db
- Export your excel document as a csv (the .csv should be the same name as your table set up in phpMyAdmin)
- Open the csv file and cut the column names out (so they are on your pasteboard) that appear at the top
- You should have just comma delimted data

- Go to Import Tab and add the location of your text file
- Select CSV using LOAD DATA
- Check 'Replace table data with file'
- Change Fields terminted to a comma, and remove enclosed and encapsulated fields
- Paste the column names from your clip board into the column names field
- Untick 'Use LOCAL keyword

Once submitted, the next page should like something like the above. If you have any questions, please post a comment.
Web Design Manly
If you are interested in sourcing website design, or online information management system, feel free to get in contact with Manly Web Design company Pixelconnect, Located on the Beautiful Northern Beaches, for an obligation free quote with your business plan and website proposal details.
Benefits of working with someone locally in Manly:
- Meet and interact with the web designers and developers
- Be active and involved in the building process
Did You Know
Awesome clip about current trends in the exponential times that we live in (With the awesome Fatboy 'Right Here Right Now' Theme song. A few that I liked.
- The top 10 in demand jobs in 2010 did not exist in 2004
- A super computer in 2013 will have a greater computational ability than the human brain, and in 2049, will have a greater computational ability than the entire human race.
- There are 540,000 words in the English language, 5x more than in Shakespears time.
- A weeks worth of news in the New York Times, is more information than what someone living in the 18th centuary would have come across in a lifetime
Add Extra Fields in Drupal Contact Form
First Drupal Module!
This module will give you extra fields integrated into your drupal sitewide contact form, and include it into your email, configurable from Drupal Administration.
There are two options for adding a phone number. The first is a required field, which is added just below where the user enters there email. The second, gives 2 check boxes, in response to how they would like to be responded to (email or phone), and if they check reply via phone, a new text input slides down with jQuery for the user the place the phone number into. This was the original idea, and purpose of this whole project, since I found what I believe was a Wordpress plugin that did something very similar on another website, and decided to replicate it into Drupal.
A third option, allows you to choose a title, and add an additional text field. It has been defaulted to 'Company Name' as I couldn't seem to think of anything else at the time.
If you would like any additional changes or extra options, let me know, and ill get back to you!
PHP CSS Theme Switcher with Cookies
Although i wrote this a while ago, figured id put it up to start my blog posts and test out how well google actually indexs’ these pages. It was also the first script i officially developed myself =)
Also it was rather relevant article to put up, due to there being absolutly no prewritten php scripts for this concept. I suppose most people are quite happy to do something like this in javascript (which is alot easier). But id figured to try and achieve this with php, for the simple reason of it being server side.
replace the first three variable names with the name of the style sheet you have available, ive used business, modern, web2 here as examples. you will need to have the style sheets uploaded on the same directory.
It is critical that this first section goes before the html <head> tag, and that there are no white spaces infront of the <?php tag, otherwise the browser will parse the white space, and the header will be already sent for the page, and not allow ’setcookie’ to work.
before doctype
<?php
$theme1 = business;
$theme2 = modern;
$theme3 = web2;
if(isset($_POST['style']))
{setcookie('style', $_POST['style'], time()+(60*60*24*1000));
$style=$_POST['style'];}
elseif(isset($_COOKIE['style']))
{$style=$_COOKIE['style'];}
else
{$style=$theme1;} ?>
head
<head>
<link href="<?PHP echo $style; ?>.css" rel="stylesheet" type="text/css" />
</head>
body
<body>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<select name="style"> <option <?php echo "value='$theme1'";
if($style == $theme1)
{
echo "selected='selected'";
}
?>><?php echo $theme1; ?></option>
<option <?php
echo "value='$theme2'";
if($style == $theme2)
{
echo "selected='selected'";
}
?>><?php echo $theme2; ?></option>
<option <?php
echo "value='$theme3'";
if($style == $theme3)
{
echo "selected='selected'";
}
?>><?php echo $theme3; ?></option>
</select><input type="submit" />
</form>
</body>
This switcher, will remember the option you have chosen with cookies (change this to a session if you would like), remember your selection in the drop down, and update the style sheet on first page load (a cookie wont take effect until the 2nd page load, since it is being set on the first page, so the selection was captured through the forms method variable).
Example here - (NB no style sheets uploaded, but you can view source to understand what i mean)

Posted in: Add Extra Fields in...
i think is good that you upload and share this module in drupal website
Posted in: Add Extra Fields in...
If you want the extra inserted fields below the title, search for the following code in the...
Posted in: Add Extra Fields in...
Hi what a great Hack. I added some additional fields, but how does new fields appear under the...
Posted in: Add Extra Fields in...
Exactly what I was looking for - just to be clear, to configure the extra fields, you must go to...