Setting up a database with MySQL and PHP

It is easy to set up a connection to a database.

Requirements for this guide:

  1. Must have a server that supports PHP and your database server must be MySQL.
  2. using phpMyAdmin – Version: 3.3.8

Create a database name, username, and password first. After you do this, then the rest is easy.

Create a connection file in php:

<?php
$host=”localhost”;
$username=”database name“;
$password=”password“;
$db_name=”username“;

mysql_connect(“$host”, “$username”, “$password”)or die(“cannot connect to server”);
mysql_select_db(“$db_name”)or die(“cannot select db”);
echo”Successful Connection”;
?>

Save this file as “conn.php” and uploaded to your web site, and then try to access this file from the Web.  If it works, it will say, “Successful Connection.”

Create a table using phpMyAdmin:

  1. In Create table, Name: web_members
  2. Number of fields: 4
  3. click ‘go’
  4. fill in the fields (id, name, lastname, email)
  5. for type(int, varchar, varchar, varchar)
  6. for length/values(4, 65, 65, 65)
  7. and then only for id select AUTO_INCREMENT

Insert data into your table using phpMyAdmin:

  1. select table, web_members
  2. click on insert tab
  3. in the value columns, skip id row but for name, lastname, email (  a, a, a@a.com)
  4. click ‘go’
  5. repeat steps 1. through 4. two more times with letter ‘b’ and then ‘c’

In the same folder, create a data retrieving file in php:

<?php

include(“conn.php”);

$tbl_name=”web_members”;
$sql=”SELECT * FROM $tbl_name”;
$result=mysql_query($sql);

// Start looping rows in mysql database.
while($rows=mysql_fetch_array($result)){
?>
<table width=”400″ border=”1″ cellspacing=”0″ cellpadding=”3″>
<tr>
<td width=”10%”><? echo $rows[‘id’]; ?></td>
<td width=”30%”><? echo $rows[‘name’]; ?></td>
<td width=”30%”><? echo $rows[‘lastname’]; ?></td>
<td width=”30%”><? echo $rows[’email’]; ?></td>
</tr>
</table>
<?
// close while loop
}
// close connection
mysql_close();
?>

Save this file as “webmembers.php” and uploaded to your web site, and then try to access this file from the Web.  If it works, it will show, “Successful Connection” and a table with the data we just entered into our database.

We are done. You should know how to connect to a database and retrieve data from a database using MySQL and php.

Source: http://www.phpeasystep.com

Gnomeo & Juliet (2011)

Gnomeo & Juliet (2011) – Bad movie. I do not like alternative lifestyles being weaved into kid movies. There is a character of a mankini-wearing Gay Gnome runing around the yard in his thong, yelling “I’m m’kay, I’m m’kay” (certainly sounds like “I’m gay, I’m gay” (duh), and I do not think this was just inadvertent. I just wish they would leave this kind of stuff out of kids movies, just like when they mess up the end of Monsters VS. Aliens in 2009.

The Adjustment Bureau (2011)

The Adjustment Bureau (2011) –

Last Week, I watched this movie. The main characters are a young guy who was running for mayor, and a young girl who was an excellent dancer. The first time they met each other was in the MEN’s room.Curious? She ran into the Men’s room after she ruined someone’s wedding on purpose. After a five minutes talk, she kissed him passionately. I was shocked. Bexause of the huge pressure, he was forced to leave her alone and focus on the preparation for running a mayor. Two years later, he met her in a street. They slept together the same day after he aplologize for missing two years.

“So you are engagined with some guy?” He held her in his arm and asked after they had sex.

“yeah” She answered with no expression on her face.

” It is not serious, is it?”

“yeah, it is not serious.” She answered with a BIG smile on her face. I have to admit that I was shocked again. I can’t help wondering whether this is how most people consider engagement in America. I look up the word when I got home. Engagement means:

Exploring Perl – First-time user

Task::Kensho is list of recommended modules for Perl developers. There are too many modules on CPAN to choose from, but reviewing this list should be your first step into using Perl.

http://search.cpan.org/~apeiron/Task-Kensho/lib/Task/Kensho.pm

Basic Toolchain: Task::Kensho::Toolchain

App::cpanminus
Get, unpack, build and install modules from CPAN 

local::lib
Create and use a local lib/ for perl modules with PERL5LIB 

version
Perl extension for Version Objects 

Testing: Task::Kensho::Testing

Test::Simple
Basic utilities for writing tests. 

Test::Most
Most commonly needed test functions and features. 

Test::Exception
Test exception based code 

Test::Pod
Check for POD errors in files 

Test::Pod::Coverage
Check for pod coverage in your distribution. 

Test::Memory::Cycle
Check for memory leaks and circular memory references 

Devel::Cover
Code coverage metrics for Perl 

Logging: Task::Kensho::Logging

Log::Dispatch
Dispatches messages to one or more outputs 

Log::Log4perl
Log4j implementation for Perl 

Log::Contextual
Simple logging interface with a contextual log 

Exception Handling: Task::Kensho::Exceptions

Try::Tiny
Lightweight exception handling that handles the vagaries of $@. 

TryCatch
Flexible exception handling without source filters, handles $@ properly. 

autodie
Make builtins and other functions die instead of returning undef on failure. 

Object Oriented Programming: Task::Kensho::OOP

Task::Moose
Moose is a postmodern object system for Perl5. Task::Moose installs Moose and optionally a list of recommended modules that extend Moose. 

Asynchronous Programming: Task::Kensho::Async

POE
Multitasking and networking framework for Perl 

XML Development: Task::Kensho::XML

XML::LibXML
Perl Binding for libxml2 

XML::LibXSLT
Interface to the gnome libxslt library 

XML::SAX
Simple/Streaming API for XML 

XML::Generator::PerlData
Perl extension for generating SAX2 events from nested Perl data structures. 

XML::SAX::Writer
Output XML from SAX2 Events 

Web Development: Task::Kensho::WebDev

Task::Catalyst
Catalyst is The Elegant MVC Web Application Framework. Task::Catalyst is all you need to start with Catalyst. 

Template::Toolkit
Template Processing System 

CGI::FormBuilder::Source::Perl
Build CGI::FormBuilder configs from Perl syntax files. 

XML::RSS
Creates and updates RSS files 

XML::Atom
Atom feed and API implementation 

MIME::Types
Definition of MIME types 

Web Crawling: Task::Kensho::WebCrawling

HTTP::Lite
Lightweight HTTP client implementation 

LWP::UserAgent
Web user agent class 

LWP::Simple
Simple procedural interface to LWP 

WWW::Mechanize
Handy web browsing in a Perl object 

WWW::Mechanize::TreeBuilder
This module combines WWW::Mechanize and HTML::TreeBuilder

Database Development: Task::Kensho::DBDev

DBI
Database independent interface for Perl 

DBD::SQLite
Self Contained RDBMS in a DBI Driver 

DBIx::Class
Extensible and flexible object <-> relational mapper. 

DBIx::Class::Schema::Loader
Dynamic definition of a DBIx::Class::Schema 

SQL::Translator
Manipulate structured data definitions (SQL and more) 

Excel / CSV: Task::Kensho::ExcelCSV

Text::CSV_XS
Manipulate comma-separated values (CSV) 

Spreadsheet::ParseExcel::Simple
A simple interface to Excel data 

Spreadsheet::WriteExcel::Simple
Create Excel documents easily 

Module Development: Task::Kensho::ModuleDev

Dist::Zilla
Builds distributions of code to be uploaded to the CPAN. 

Module::Install
Standalone, extensible Perl module installer 

Devel::NYTProf
Powerful feature-rich perl source code profiler 

Perl::Tidy
Parses and beautifies perl source 

Perl::Critic
Critique Perl source code for best-practices. 

Carp::Always
Warns and dies noisily with stack backtraces 

Modern::Perl
enable all of the features of Modern Perl with one command 

Perl::Version
Parse and manipulate Perl version strings 

Software::License
Packages that provide templated software licenses 

Pod::Readme
Convert POD to README file 

CPAN::Uploader
Upload things to the CPAN 

Email: Task::Kensho::Email

Email::Simple
A simple email object. No, really! 

Email::Valid
Check validity of Internet email addresses 

Email::Sender
A library for sending email 

Email::MIME::Kit
The Swiss army chainsaw of assembling email messages 

Date Modules: Task::Kensho::Dates

DateTime
A date and time object 

Date::Tiny
A date object with as little code as possible 

Time::Tiny
A time object with as little code as possible 

DateTime::Tiny
A date object with as little code as possible 

Time::ParseDate
Date parsing both relative and absolute 

Scalability: Task::Kensho::Scalability

CHI
A unified cache interface, like DBI 

Config Modules: Task::Kensho::Config

Config::Any
Load configuration from different file formats, transparently 

Config::General
Generic Config Module 

Useful Command-line Tools: Task::Kensho::CLI

App::Ack
A grep-like text finder 

App::Nopaste
Easy access to any pastebin 

Devel::REPL
A modern perl interactive shell 

Module::Corelist
What modules shipped with versions of perl 

App::perlbrew
Manage perl installations in your $HOME 

Script Hackery: Task::Kensho::Hackery

These packages are included less for production work and more for whippitupitude. They reflect packages that people have found incredibly useful for prototyping and debugging before reducing down to a production script.

Smart::Comments
Comments that do more than just sit there 

Term::ProgressBar::Simple
Simple progress bars 

IO::All
IO::All combines all of the best Perl IO modules into a single nifty object oriented interface to greatly simplify your everyday Perl IO idioms.