Tuesday, March 20, 2007

Free Tutorial - Build a website v1.0 part 1 - Adding a database and table into MYSQL

To add a database in your new MYSQL server, you need to go to http://localhost/phpmyadmin/ Here you will be able to login using you user+password that you created in the previous tutorial.

Here you can find the: Somewhere in the middle of the page. For example, name your new database: my_database, and hit the create button.

Voila! you've just created a database. Your first database! wasn't that hard was it?
ok. now for the tables....
there is a Create new table on database my_database somewhere in the page right afther you created the database. there you can add a table name and the number of Fields.

The number of fields is important but can be changed from settings while you are givving specific names and attributes to the fields.

Now... .let's make a table named users with 5 fields.

you maybe wondering why 5.... well.... because I say so!..... :)....ok..no...actually...it's because I want to add An ID, a user first name and a last name (separate) and the user age and description. 5!


why all these? because I want to make them of different types.

Hit GO and shut up!

The ID is the unique identifier. It is very recommended that an ID should be created in any table. IT is a unique number that auto-add's 1.....or.....act's like +1 each time a new field is inserted into the database.

to create an ID, let's:
~ type in the first field textbox the name : ID
~ select from the same row the type of INT from the dropdownbox
~ write the value of 9 in the Length/Values Section
~ From the EXTRA dropdownbox select the auto_increment value
~ Click the radobutton on the same row where there is a key (primary key if you hold mouse over radiobutton or icon)

and....fwew!!! ID is created.

You must select from the EXTRA and the primary key only for the ID button.
the rest of the fields will just make the first 3 steps....with minor modifications.

The second row let's type in the field: first_name
Select the varchar from type and write 121 in the lenght
next row, same thing except for the field , where u write last_name
in the next row, write age, select int again from type and write 3 in lenght
Last row, write description in field, select text and don't write anything in lenght

not...to explain....

darn! I was hoping that it would of been over by now too.. :(.....hold on to your .......hat!
here we go....

the INT is an integer...meaning numbers and the lenght is the ....well...lenght of the field
for example..if I add 3 as lenght, I can only insert into that table and field numbers between 0 and the maximum 3 digit number (999)... u get the ideea...

VARCHAR is a character type.... I can add as many characters as I want..but...there is a limit!
This is important when doing searches and queries later (the big programming starts there)

TEXT is a infinite VARCHAR.....no restrictions....add your book or something,....


hmm.....
questions?
no?
yes?

Done!
Bye!
see u later!
hope it helped!
thanks for watching!
arrivedercy
come back soon
gtg
keep in touch

ciau!

cy21

Free Tutorial - Build a website v1.0 part 1 - Installing APACHE server and MYSQL database

This tutorial will show you how to create a simple but professional website. It will take you to the coding and designing basics for a site creation.

PHP - scripting language used
Mysql - Database

In order to work with PHP and MYSQL you will need a server and the mysql database running..
To help you install these things quick and easy... go here:
http://www.apachefriends.org/download.php?xampp-win32-1.6.0a-installer.exe

You will download Xampp. A application that automatically installs Apache Server and Mysql Database to your computer.

The installation is very easy....just the next>next>next finish procedure :)...

I'm not going to go much in this...if you would like to study this system......for further information go to:
http://www.apachefriends.org/en/xampp-windows.html#522

When it asks if you want to install Apache server and mysql database, please confirm.

NOW, THE MOST IMPORTANT THING you must do after you've just installed APACHE and MYSQL is to take care of the security issues.

Right now, you are EXPOSED to a lot of hackers....
just type http://localhost/ in your browser...you will see that your browser is working.....
but....also...your database. So, if you type http://localhost/phpmyadmin/ in your browser's address bar, you will see that your database is up and running. Just 1 problem: It's up and running for EVERYONE. So, everyone has access to your database right now.... and...I think you won't want that.

So what do we do?
Follow these steps exactly and you will be protected against hacker attacks:

1. go to http://localhost/phpmyadmin/ and click Privileges


2. Select the edit on Root like in the picture:
3. Go to change password and select the Password radio button like in step 1 in the picture, then type and re-type your password like in step 2 and finally click GO.
IMPORTANT!!!!! REMEMBER THE PASSWORD!
Right now, if you try to reload your http://localhost/phpmyadmin/ you will see that it does not work..because you do not have the privileges....it gives an error.

now...the hard but necessary part starts.
4. find the config.inc.php file.
config.inc.php is located in your Xampp directory , inside the phpmyadmin directory
Xampp by default is usualy installed in your Program Files Directory
path where you installed xampp\xampp\phpMyAdmin\config.inc.php

Edit the file with Wordpad or any other richtext editor (not with notepad!!!)

5.edit the file config.inc.php and search for the lines:

$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = 'root'; // MySQL user
$cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed


and make these modifications:


$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = 'root'; // MySQL user
$cfg['Servers'][$i]['password'] = 'The_password'; // MySQL password (only needed

- The HTTP (in $cfg['Servers'][$i]['auth_type']) means that anyone who tries to access your phpmyadmin will be getting a user/password verification window where they must know the user:root and your password

- the password (in $cfg['Servers'][$i]['password']) means that you are setting your password information with the new password that you just created.
You will be prompted for the user and password each time you try to enter PHPmyadmin.

Right now you are pretty much secured from any hacker that's trying to ruin your database and hack into your system....

If you
Want to test your server, you can create php or html files....and add them in the HTDOCS directory from xammp directory.
The HTDOCS directory is the path where you will add your files for the site.
That's IT for now.... next part will be: Adding a database and table into MYSQL

Continue tutorial >

Wednesday, March 14, 2007

Free tutorial - Website from 0 to 100%

Hello there. I am announcing the start of a tutorial about how to build a website on this blog.
There will be more types of sites. The first one will be a easy site for beginners.

I will show you how to create a Apache server, mysql database and how to secure it. then I will tell you what you need to do to start the site....and I will guide you step by step in the site building process so you will fully understand how to create the site from 0 to 100%.

We will make everything together! the mysql database, tables and fields.... the HTML, SQL and PHP coding for the site.
The site will be a simple one... with login and registration forms and with a place where user can submit a story for example. login/logout view etc....

this will be a basic site for beginners...but it will look and feel great :)

The tutorial will be broken in pieces and versions so...it won't be just 1 page.....(it's not exactly a walk in the park)....so....you will start with downloading and configuring the apache server and mysql database today...and tomorrow(for example) wi will start to do the HTML and PHP coding....

So...It will be a long tutorial :)...but at the end of it....you will know how to build your own site like a professional developer.

I will announce soon when the day of the beginning of the tutorial will be :)....
(PS:it will be this week or next week)
Cy21

Saturday, March 10, 2007

Deete Table from Mysql Database using PHP function (NO SQL)

Like the previous function, again, you get to call a function in PHP that does all the SQL work for you...
//
function db_table_delete($table,$where,$equals)
{
mysql_query("DELETE FROM `".$table."` WHERE `".$where."` = '".$equals."'");
}
//

Update mysql with PHP (no SQL)

ok...you can change only 1 value at a time. A more complicate function will be posted later. But this is just to give an idea...for beginners, or people who update (for some reason) 1 field at a time in mysql using php. This is a useful function. I never used it myself...but I created it for possible future uses.

//
function db_table_update($value_name,$value_update,$table,$where,$equals)
{
//value that needs to be changed, new value,table, where x, equals y
mysql_query("UPDATE `".$table."` SET `".$value_name."` = '".$value_update."' WHERE `".$where."`='".$equals."'");
}
//

You must already be connected to the database to use it.... you just call it like this:

db_table_update("the value name to change", "the new value","table name","where something","equals something");

hope I helped :)
cy21

Monday, March 5, 2007

Another fast, simple HTML Video Tutorial 4 beginners

A very simple video....About changing backgrounds in HTML.



Enjoy

Sunday, March 4, 2007

Dynamic HTML Table PHP Function - Very useful and FREE

As I promised, I would post the PHP Function that you can use to create dynamic tables that contain pictures like in my previous post:

< ?php
function cc($content,$path,$width=NULL,$height=NULL,$align="center",$valign="top")
{
////margins
$margin_right_up=$path."margin-ru.png";
$margin_right_down=$path."margin-rd.png";
$margin_left_up=$path."margin-lu.png";
$margin_left_down=$path."margin-ld.png";
////borders
$left=$path."left.png";
$right=$path."right.png";
$up=$path."up.png";
$down=$path."down.png";
////center
$center=$path."center.png";

?>

< table border="0" cellspacing="0" cellpadding="0">

< ?php td_pic($margin_left_up);? >
< ?php td_pic($up,$width);?>
< ?php td_pic($margin_right_up);? >
< /tr>
< tr>
< ?php td_pic($left,NULL,$height);?>
< td background="< ?php echo $center;? >" valign="< ?php echo $valign;? >" nowrap="nowrap" align="< ?php echo $align;? >" >< ?php content($content);? >< /td>
< ?php td_pic($right,NULL,$height);? >
< /tr>
< tr>
< ?php td_pic($margin_left_down);? >
< ?php td_pic($down,$width);? >
< ?php td_pic($margin_right_down);? >
< /tr>
< /table>
< ?php

}
?>
// Ok. I know it has a lot of values as a function, but most of them are default. You can set them or not. The idea of this function is that you can cut the picture as shown in the previous tutorial and save those pictures according to the names of each...
You can see in the code the commented variables with the margins and borders and center ....
So basically you just need to create a folder where you put all these....and then you do the following:

You want to have the new form filled with some content.... so...you set the path on the $content Variable.(path to the file you want to show in the content...)

You must set the path to the picture files.This is done in the $path variable..the second one in the function.

The rest of the variables are $width, $height(if you want a specific width and height), $align (where to align the content), and of course $valign(if you want to choose where to align it).
This function is a little flexible as you may see.....
You can do a lot of work very fast with it, and you can change the code how ever you like, in order for it to look like you want it to.....

Enjoy,
Cy21

Saturday, March 3, 2007

Basic HTML Learning - VIDEO Tutorial

I've found a great HTML tutorial on Youtube.com . It's very, very, very good for people who just started learning HTML. IF you want to make a site, if you need make a school project, or...are just curious on how things are done in the programming world ......this will help you to get there fast and easy.
Tell me what you think




Welcome back Digg.com... What happened?

03 March 2007 for a few minutes, DIGG.com looks like this:Of course..... or number 1 source for news, videos etc is back and working now.....but....What happened???

Did some hacker got in and did something?
Did their servers crash?
Power out?
Somebody who did not know what they are doing was messing around with the "RED BUTTON"?
I did not see any change in the design.......so.......does anybody have a clue?
IF yes....please post here.

Again....Nice to have you back Digg :).



Cy21

MYSQL basic VIDEO tutorial

Here is another good tutorial I found on YouTube that will help you understand mysql Sintax....
it's only 3 minutes but you learn some basic useful stuff.... this is for beginning WEB programmers.
IT shows you how you can create database, view it...errors on creating the same database again and commands how to verify so errors will not come again....
Enjoy ;)




DIGG THIS

PHP Tutorial - VIDEO

Here is a very useful PHP video I found about login script :)...tell me what you think



DIGG THIS

Send emails from anyone to anyone - simply magic

Yes! you can actually send emails from anyone to anyone! You can send emails to people from their own email address and you won't have to break into their email address account. It's actually very simple, and I'm going to tell you how it's done.
Be aware that this is not exactly legal. I'm just saying that it's possible...but....it's not legal....so....I don't encourage you to do it. The person that you are sending emails to.....will receive it from the email that you want it to receive.

There is a function in PHP....the mail function. That is used to send e-mails to the people on your site.

In order for PHP to work on your computer, you need a Apache server...witch can be set up by downloading XAMPP (that is very easy to install).

Install xampp fom the folowing link: http://www.apachefriends.org/en/xampp.html .

Then, in order to send a E-mail, you must create a PHP file exactly like this:

< ?php
$to = "someone@domain.com";
$subject = "The subject of the message";
$message = "The message you want to send.";
$from = "someone@domain
.com";

$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Your E-mail Has been sent to ".$to." from ".$from;
? >

You just need to modify the content between the quotes of

$to
$from
$message
$subject

And your mail is ready!
After you run it, you will see a message that says:
Your E-mail Has been sent to recipient_mail from sender_email 
Save the file and run it. You can test by sending an e-mail from yourself...to yourself.
But be aware! sending emails to people from false email addresses is not legal!
I do not encourage you to do this! I'm just saying that it's possible and I'm telling you how the e-mail function works in PHP.

Thanks 4 reading,
Cy21


Friday, March 2, 2007

different types of fonts

I would highly recommend fonts! They look good, there are plenty to choose from and gives a special look to your site...
Here is a list of fonts, sizes and how they look:


These are just a few examples. But they are used today a lot.
here is an example how these fonts where created(tables where used):
< align="left">< style="font-family:arial; font-size:10px">Arial< / span>< / td>
< align="left">< style="font-family:arial; font-size:14px">Arial< / span>< / td>
< align="left">< style="font-family:arial; font-size:18px">Arial< / span>< / td>
< align="left">< style="font-family:arial; font-size:22px">Arial< / span>< / td>

Cy21

Thursday, March 1, 2007

IF Statement - for beginners


When ever you want to check if something is correct in your code, you can use the IF statement.
Basically, it is very simple:

IF(something is true) then do { the code in here }

There is another property of this statement.... it's called else, and it comes in if the code that you are verifying is not true, and you want to run some functions or some code in that case. ELSE works like this

IF(something is true) then { the code in here } else { the code in here }

So, You can verify if something is true or false and then do something on both cases.

Here is a PHP example:

//
if($words=="123")
{
$x++;
}
else
{
$i++;
}
//

In this case, if the variable $words has the value of 123 then the variable $x will have the value of $x+1; if the variable $words has the value different than 123 then the variable $i will have the value of $i+1.
Any Questions? :p