Friday, December 21, 2007

Modify your pictures online for free Free

The site uses GD libraryes..... www.pic2res.com
the page for modifying pictures is: http://www.pic2res.com/index.php?p=5&p2=1

Thursday, December 20, 2007

Pic2res.com – Growing up to be a new success in the pictures business?

The newly acquired domain seems to be attracting people more and more..
Originated from Romania, the owners are a small group of individuals that came up with this great new Web 2.0 application that will hopefully be next to the top names.
It seems that they started with this idea: “No matter the price or the failure, we will never stop and we will never sell”.
The site is a Gamma version site (continuous construction and development), but it is a working version it it's evolution process...

I understand the “2” in pic2res is from it's 2 capabilities: hosting and editing pictures. You can filter and edit your pictures adding all kinds of stuff over your pictures, hearts, balloons, animals.....all kinds of transparent pictures that (here comes the best part), can even be your own pictures. You can upload your own pictures and create multiple pictures picture, with effects and transparent overlays, and if you have your own transparent pictures or you are a designer and you like to add those effects, you can.
Also, you have the ability to group your pictures in albums and give them names and descriptions...
The interface is extremely simple, even a 5 or 7 year old can figure things out and make a great picture with effects frames and filters....
There's a video on youtube.com showing just how easy this is.
The site gives users the ability to upload unlimited pictures and let other people comment them, rate them etc.

Enough about the functionality.

The site already indexed by Google as soon as it came out, has no rank yet (it takes time for any site) but it jumped from 8 million to 800 000 in just 2 weeks on Alexa, and I presume it will go under 500 000 in one more week, maybe even lower... It still needs time to get indexed well, but it looks promising so far, many other (smaller) search engines containing it already.

People are adding new pictures each day and the little thing that I like about this site is that it creates 3 extra pictures, as modified pictures, each time a picture is uploaded. Cool no?

Share your impressions and make an idea if this is next or not.

Tuesday, December 18, 2007

Modify your pictures online Free

How to modify your pictures online for free, fast and easy....
Again, my site: Pic2res.com
here's the tutorial:

Friday, November 16, 2007

I lounched my site today : www.pic2res.com

It's fresh and it's my site... www.pic2res.com
You can upload and share pictures and more....you get 9 versions of your pictures...modified with efects...
check it out ;)

in the future more efects will come, custom animations, and more.....

www.pic2res.com

Tell me what you think

Tuesday, October 30, 2007

Download Yahoo Messenger for Vista now!! (beta version)

The new Yahoo messenger for windows Vista( Yahoo messenger 9) beta version is here.
Download it and test it now.

Here is the link:

http://beta.messenger.yahoo.com/

Enjoy, and please leave feedback,
Cy21

Update:
Upon further consideration, I realized that yahoo may be making 2 new versions of yahoo messenger. One for XP and one for Vista. Not sure what's going on but I think this might be it.....
This version is the XP version from What i can tell....

Saturday, October 27, 2007

Why I love Windows Vista.....

Article Has Moved HERE

Yahoo messenger 9 (for Vista) - how to make it work on XP

Hi there,

Yahoo Messenger 9 is the last Version so far. It's here, it's fresh! download it to see the brand new WPF power of vista :).

But wait!?!
It just came out and there is a problem???

People using Windows XP get an error.... It seems it's for Vista and Vista only. And you must upgrade to Vista in order to have it and make it work.
Well, NO! you can make it work on Xp too...
You need Framework 3.0 which can be downloaded here
and voila! it works!
Enjoy,
Cy21

UPDATE: here is what everyone needs

Saturday, July 21, 2007

A free PHP script, converts RSS feeds to HTML

Article has moved HERE

Windows 7 is New Windows after Vista ?

Microsoft is getting ready for it's new operating system and it seems that it's going to be ready in the next 3 years. The child of Windows Vista will be named Windows 7 (so far) and it will be (as Microsoft said) a FULL OS.... so far so good...here is an article that says more: CLICK HERE

Tuesday, June 26, 2007

Wednesday, June 13, 2007

Simple web design tips

Article has moved HERE

Add articles/scripts here for free

Right now, this site has a 5/10 google RANK , that means that I am very hight on Google.com and the possibility of someone finding articles on this site is very BIG.
I can help you spread your scripts on the internet and you can be a volunteer that can help this blog grow.
You can add your scripts(php, javascript, sql, mssql, asp, CSS, HTML, etc)....web developing scripts on this blog for all the visitors to see by sending me an email at: ciprian_vb@yahoo.com.
send me the Article title, article content and your name and I will post it for you here.
Please write in the subject: Article for blog.

You can even add parts of articles, and links back to your site/blog !!!
Best thing is.......you can do this...for FREE!!!

I'm not charging anything. why should I ? you are helping the blog grow and the blog is helping you.
I want to make this a good blog that will help a lot of people in trouble with WEB code :)

Waiting for your emails,
Thank you,
Ciprian

How-to manual install mysql 4.1.22 in ubuntu

Article has moved HERE

Export mySQL - Excel

Article was moved HERE

Export mySQL - PDF

Article was moved HERE

COOL PHP and MYSQL tutorial

Article was moved HERE

How to install mysql...

Article has been moved HERE

Handling Screen Resolution Issues in Javascript

Article has moved HERE

ColdFusion with Ajax - Without Writing Javascript!

Article was moved HERE

Persistent Undo/Playback manager in JavaScript

Article has moved HERE

PHP Password Strength Algorithm

Article was moved here

Javascript Performance: OmniWeb, Opera, Safari, Firefox, Netscape & Camino

Article was moved HERE

Change font size with css and javascript.

Article was moved HERE

How to create a pre-loading effect using Javascript

Article was moved HERE

Increase your eBay seller rating with a little javascript in your template

Article has moved HERE

CSS Tutorial: Create CSS image rollovers with a single background image

Article Has Moved HERE

xhtml javascript flash validated?

Article has moved HERE

Really Awesome Javascript Trick Effect

Article Has Moved Here

How to enable the JavaScript console in Safari for Windows

Article Has Moved HERE

PHP Browser Detection and Appropriate CSS Generation - CSS Tips

Article Has Moved HERE

Vertical Centering in CSS

Article was moved HERE

What is CSS?

Article was moved HERE

Complete PHP Tutorial on Making a CAPTCHA

Article was moved HERE

How To Generate Monochromatic CSS Stylesheets Within Seconds Using PHP

Article was moved HERE

Beautify PHP source Code

Article Was Moved HERE

PHP Game Creation PART 1: account creation

Article Was Moved HERE

Common PHP string manipulation functions...

Article Was Moved HERE

Dynamically Creating Compressed Zip Archives With PHP

Article Was Moved HERE

Advanced PHP Programming

Article Was Moved Here

Forum AdManager - Passive Income from Your phpBB Forum

Article Was Moved Here

PHP Protector

Article Was moved HERE

DreamweaverHowTo.Com Tutorials Training Video 2

Article Was Moved HERE

DreamweaverHowTo.Com Tutorials Training Video 4

Article Was Moved HERE

Dreamweaver Site Setup Tutorial

Article Was Moved Here

DreamweaverHowTo.Com Tutorials Training Video 1

Article Was Moved Here

Integrate flash in dreamweaver tutorial

Article Was Moved HERE

Dreamweaver Rollover Buttons Tutorial 3

Article Was Moved HERE

Dynamic webpage using dreamweaver mx

Article Was Moved Here

Dreamweaver tutorial -How to Define a Local Root/Site Folder

Article Was Moved HERE

MySql training

Article Was Moved HERE

How to build a website 5 min tutorial

Another great tutorial I've found on youtube, that shows you how you can build a website using dreamweaver... step by step...easy as pie ...no? ;))

Dreamweaver - Button Rollovers - Video Tutorial

Learn how to create buttons rollovers in dreamweaver...
I found a very good Step by step Tutorial on youtube...
Enjoy

Great Dreamweaver tutorial

I found a great tutorial for dreamweaver on youtube....
if u are a beginner and you are looking for a few more tricks on dreamweaver, this is perfect...just look...leave a comment with impressions please :D

CSS Style HTML Tables

Learn more about CSS styles and TABLES here. Easy tutorial for beginners...

lern how to make a website html + css

Learn how to make a website using html and css...
easy and fast to learn for anyone...
downlowd higher quality at
http://myweb.tiscali.co.uk/wells1/danny

Basic HTML and CSS Intro

Learn HTML and CSS basics. VEry easy tutorial for begginers level.

CSS easy Tutorial - Body, Input, Select

A very usefull CSS Tutorial for begginers on making the body, inputs and selects more unique. step by step tutorial. Enjoy...

CSS Tutorial - Div Layers, Classes

Very useful CSS tutorial about DIV , layers and classes....
This is a CSS Tutorial that will help you position an image using a div layer.


cy21

Insert Record PHP tutorial

Extremely funny voice on this tutorial. Like one of those old time television presentors...
Anyway...it is about a record insertion tutorial.....gives you all details, very good
Watch and learn ;).

PHP,HTML Tutorial // POST, Table, Forms

A PHP and HTML Tutorial in which we processes information from a form using the $_POST[]; functions in PHP and created a table and form.
Great for beginners ...

A PHP Tutorial about the basics of Math

Good for school or even for work.. A php TUTORIAL that show's u how to do simple math * + - / calculations...
this is for beginners,
Enjoy

cy21

Simple PHP Calculator Tutorial

A very easy and good PHP Calculator Video Tutorial....
Step by step instructions...
Enjoy,

Cy21

SQL injections for dummies - and how to fix them!

Another SQL injection video I found on youtube. Again, please do not hack anything unless it's your server and you do it to learn how to prottect yourself.
Enjoy the video....

cy21

SQL Injection - easy but important security tutorial

I've found a method of SQL injection on Youtube , a video tutorial that will help you understand how hackers can login to your site if it's not well protected. This video tutorial is for informational purposes only, for developers to know how to fix a security problem in theyr system. Please do not attempt to hack any website with this technique.
Thank you,

Cy21

User Registration Video tutorial PHP


A great User Registration Video Tutorial made in PHP that I found on youtube..
enjoy,
Cy21

Saturday, May 26, 2007

Simple PHP session Tutorials

A tutorial About Sessions In PHP....how to declare and use them.
Tutorial for beginners. Enjoy.

Monday, May 7, 2007

Basic PHP tutorial 01.01

Ideea............

I've been thinking lately and....text tutorials are sometimes boring...so... I thought ...why not make video tutorials? :D/...so....I am pleased to announce that, from now on, allmost each and every tutorial on this site will have a video attached to it.

But scripts and functions will be just given away as text.

hope to hear some impressions....
cy21

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

Wednesday, February 28, 2007

Delete Database fields...

Creating is very important, but sometimes you also need to delete. So, let's say you need to delete a certain place in the database. A field containing a user name for example. The function you are supposed to use is the mysql_query(); function in PHP.
So let's say that the table we are using is named users and this table contains the fields: ID, user_name, password and email.
In order to delete the correct value, we need to know the ID value of the user_name that we want to delete, because it's a unique value.
This is the function:

mysql_query("DELETE FROM `users` WHERE `ID`='2' ");

Right now, ID, user_name, password and email is completely deleted from the database.
This is a very easy example for beginners.
In later posts I will show you more complex examples where you can use PHP variables extracted from the database or set by you etc....
Enjoy.

Broken board :(


The white board that I used to make "art" pictures for explaining and hopefully entertaining YOU, was broken today when I accidentally stepped on it (was on the floor). I will probably make a new one but I don't have time right now as I am very busy. So Photoshop pictures containing similar "data" will have to do......
If I get enough posts that request the board back, I will make one fast. I forgot to make pictures of it. :(
Until then... happy reading
Cy21

Tuesday, February 27, 2007

Sorting (Again)- but this time, easyer


The last post was about posting too but there I presented a general, well known sorting algorithm(Bubble Sort) that sorts a string of numbers.
PHP has a simple function that does a lot of things in the sorting world but comparing to Bubble Sort, You don't need to see and understand the source code.
The function looks like this:

array_multisort();

and it can sort 1 or even 2 dimensional arrays....
you can use it by giving values like: the array, sorting order, sorting type.

array_multisort($array,sorting order, sorting type);

The array option is recommended but the other 2 are optional....
For the sorting order, you have the following options:
  1. SORT_ASC - sort in descending order (ex: from A to Z)
  2. SORT_DESC - sort in descending order (ex: from Z to A)
For the sorting Type you have other options:

  1. SORT_REGULAR - This option compares elements in a normal way
  2. SORT_NUMERIC - This option compares elements as numeric values
  3. SORT_STRING - This option compares elements as string values
You can optionally add more arrays...

That's about it... You just call the function. and set the objects. It does everything...FAST MAGIC :)

Bubble Sort - How it works

//
function BubbleSort( $items ) {
$temp = "";
$size = count( $items );
for( $i = 0; $i < $size-1; $i++ ) {
for( $j = 0; $j < $size - 1 - $i; $j++ ) {
if( $items[$j+1] < $items[$j] ) {
$temp = $items[$j];
$items[$j] = $items[$j+1];
$items[$j+1] = $temp;
}
}
}
}
//
In order to sort an array of n items, we can use this Bubble Sort Algorithm.
How it works: It's a function, that you call it and place in it, as a value.. ...the array of the items you want to sort. IT compares 2 elements. IF the first one is greater then the second one, it swaps them. And this thing is done with all of the elements, from the first 2...until the last 2. The step keeps being repeated for 1 fewer elements each time. So...basically, the step is being done until there are no more pairs to compare. As you can see, there are 2 FOR statements one inside the other. 2 Loops, one included in the other. It's a simple, but very known and used algorithm. to use it: for example you have an array of 5:
$x[0]=1;
$x[1]=6;
$x[2]=4;
$x[3]=2;
$x[4]=5;

$new_array = BubbleSort($x);

now, the content of the new array will be:
$new_array[0];//1
$new_array[1];//2
$new_array[2];//4
$new_array[3];//5
$new_array[4];//6

Monday, February 26, 2007

Making a Dynamically resizable Form - secrets


Let's say you have a form like the one in the image on the left. You've just created this form in your favorite picture editor and you wish to add content in it. But, you find that you have more than 1 problem: the picture you've created is too little or too big for the place you want to add it into your web page, and the content is going to change so if you have more content, you will be forced to make the font smaller so the picture will be just 1 and not 1 and 1/2 :).

So, what do you do?

You cut your picture into small parts. so that it will dynamically change according to the content. So..if you have 3 pages of content, your "picture" will be 3 pages in height and if you want to make the picture wider, no problem, same thing :).
In order to better understand how the above picture is supposed to be cut, I will show you another picture:
The areas marked with green are the areas that are supposed to be cut and transformed into separate pictures. You have to use tables for this procedure. each picture will be a new table. the margins(corners) on the left, right(both up and down margins) are supposed to be fixed in size.(fixed width and height) the middle left, right, up and down are supposed to be 1 pixel wide(for up and down) and 1 pixel in height (for left and right). If you do this, you will have great borders, exactly like your picture.

Why?

Because the left, right, up and down bars are made out of 1 small picture. if you set that picture the sizes mentioned above, if you add content, no matter how much, the picture will automatically resize...... the picture repeats itself.

You still haven't finished. The center must be a picture 1 pixel in width and height that is created from the middle of the original picture.

If it's still not clear, comment and I will answer your questions.
In a later post, I promise a PHP function that automatically does everything needed to be done in HTML coding.... that's mentioned above. You will still have to cut your picture :).

Cy21

Sunday, February 25, 2007

Insert into Mysql Database - SQL commands

You have a database that has a few tables in it and you want to add some values in those tables (more exactly in the fields of the tables). So what do you do?
You can:
- go to PhpMyadmin and just select the database, table and insert the values.
- you can LEARN how to write the SQL code so that the values will be entered in the proper place.

So, let's do that :).

In order to insert something in the Mysql database you need to use the INSERT INTO command. After that you write the name of the table like so: `table_name` and then you start enumerating the fields between ( ) like so: (`field1`, `field2`, `field3`) next you add the values by writing VALUES and then again the values that need to be stored in the previous fields, IN THAT EXACT ORDER!!!! like so: ('value1', 'value2', 'value3') and then you end with a ;.
This is how the full code is supposed to look like:

INSERT INTO `table_name` (`field1`, `field2`, `field3`) VALUES ('value'`, 'value2', 'value3');

you notice that the fields are in one type of brackets and values are in another type.
like this: `field1` and 'value1'. only values must be in ' ' .Everything else is in ` ` :)

Hope It helped,
Cy21

Extract data from Mysql Database

Ok, so you have some data stored in tables in your Mysql Database. How do you get that data out? I'm going to show you a very basic and easy way to get that data out of the database. Let's name teach thing we are working with. The table is named "my_table", and let's say we need to extract data from the following fields: "ID", "user_name", "password".

How do we do this?

First we make a new variable.Let's name it "$query". we assign to that variable, the PHP function mysql_query(); with the SQL request that extracts the inside the function like so:

mysql_query("SELECT * FROM `my_table`");
Right now, the variable $query contains an array with all of the values in the "my_table" table.
To get that out, and store it into other variables so we can use it we need to make a while loop work. To store all of the data into variables I will make an array of variables.I will continue the example using the commands again:
$query =mysql_query("SELECT * FROM `my_table`");
$i=0;
while($row = mysql_fetch_array($query ))
{
$ID[$i]=$row['ID'];
$user_name[$i]=$row['user_name'];
$password[$i]=$row['password'];
$i++;
}
Right now, the $ID,$user_name and $password are arrays that contain all of the values of the table "my_table".
To check a value you use the echo function:
echo $ID[0];
or
echo $user_name[5];

Enjoy.

Saturday, February 24, 2007

PHP file include file in code


A very useful function that PHP provides is the include() function. It gives you the possibility to add the content of one file in another. So, for example if you want to make a very loooong script that does something important and you don't want the page you are working on right now to be filled with all of that content, you can use a IF statement and in that IF statement, you can add:

include("file_path/file_name.extension");

Now, you have one file included in another, and you have just 1 line of code more ......
This is a basic easy function. More to come.........

Nr of days - Date Function PHP

//
function date_return($days,$start_date=NULL)
{
if ($start_date!="")
{
$start_datex = explode("-",$start_date);
$day=$start_datex[0];
$month=$start_datex[1];
$year=$start_datex[2];
}
else
{
$day=date(d);
$month=date(m);
$year=date(y);
}

$default_month=$month;
while($days>0)
{
$x = cal_days_in_month(CAL_GREGORIAN,$month,$year);
if($default_month==$month)
{
if($day+$days > $x)
{
$days=$days-($x-$day);
$day=0;
if ($month==12)
{
$year++;
$month=01;
}
else
{
$month++;
}
}
else
{
$day=$day+$days;
$days=0;
}
if ($day<10 style="color: rgb(51, 51, 255);">strlen($day)<2){$day="0".$day;} style="color: rgb(51, 51, 255);">strlen($month)<2){$month="0".$month;} style="color: rgb(51, 51, 255);">strlen($year)<2){$year="0".$year;}> $x)
{
$days=$days-($x-$day);
$day=0;
if ($month==12)
{
$year++;
$month=01;
}
else
{
$month++;
}
}
else
{
$day=$days;
$days=0;

}
if ($day<10 style="color: rgb(51, 51, 255);">strlen($day)<2){$day="0".$day;} style="color: rgb(51, 51, 255);">strlen($month)<2){$month="0".$month;} style="color: rgb(51, 51, 255);">strlen($year)<2){$year="0".$year;} date="$day." style="color: rgb(0, 153, 0);">return $date;

}
//


Returns a date after you give it a number of days and a starting date. You can leave the start date blank , and it will give the current date as a start date :).
For example, you can calculate when does a customer have to pay you if he applied for a number of days for your product or service. the function will give you the exact date.

A lot of strings are cut and calculated in order to show a good date, with a 0 in front of a number if the number is smalled than 10.
To call the function you can type:
< ?php $date=
date_return("30"); //will show a date 30 days from now
$date=date_return("30","12-03-2001"); //will show a date 30 days from 12-03-2001
? >
If you wish to sate a starting date, you need to make it exactly like this:
day-month-year, separated by a "-".
That's all!

Scrape Web Page script



//

function getRSS($xml_url)
{
$handle = @fopen($xml_url, "r");
if ($handle)
{
while (!feof($handle))
{
$buffer.= fgets($handle, 4096);
}
fclose($handle);
}
return $buffer;
}
//

With this PHP script, you can extract all of the HTML information of any web page and store it in a variable. From there, you can cut it and find certain parts of it to use how ever you like. The way you use this script for extracting web page content is your responsibility.
To call the function and store it in a variable you type this:
< ?php
$variable = getRSS("http://www.google.com");
? >

Rename a file on your hosting server

//
function rename_file_hex($name,$path)
{
@$newname = md5_file($path.$name);
$ext = @substr($path.$name,$lenght-4);
@rename($path.$name,$path.$newname.$ext);
}
//

This PHP function renames a File from your server to a "HEX_name.extension".
So this way, you will have a file with an unique name. You just need to know the name of the file(before it is changed) and the path on the server. The function it is called like this:

< ?php
rename_file_hex("file_name.jpg","file_path"); ? >

Upload files simple function

//
function
upload_files($path)
{
if ($_FILES["file"]["error"] > 0)
{

}
else
{

$name = md5_file($_FILES["file"]["tmp_name"]);
$lenght = strlen($_FILES["file"]["name"]);
$ext = substr($_FILES["file"]["name"],$lenght-4);
if (file_exists($path . $_FILES["file"]["name"]))
{
move_uploaded_file($_FILES["file"]["tmp_name"],
$path . $name.$ext);
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
$path . $name.$ext);
}
}
return $name.$ext;
}
//

In order to call this PHP function you must already have the value of the file object sent to the page where you are calling the function. So, basically you must have a web page that sends that information. the form must contain the enctype="multipart/form-data" in it's content in order to send the file information right.
The input will look like this:


<input type="file" name="file" id="file" />

A textbox and a
Browse Button will appear. You can select your file from there and send it with the form on your page where the function will take the data and upload it.

The function is called like this:

< ?php
upload_files("path_2_save_on_the_server"); ? >

The file will be automatically renamed to it's equivalent in HEX so it will have an unique name :).

Mysql connect Function

//
function connect_db($localhost,$user,$password,$database)
{
mysql_connect($localhost,$user,$password);
mysql_select_db($database);
}
//

You use the mysql_connect function and the mysql_select_db function at the same time in 1 new function created by you. Saves up a few seconds of your time. ;)
So actually, you just call 1 PHP function:
< ?php connect_db("localhost","username","password","database") ? >
and VOILA!!! you are connected to your database!

Technorati Profile

Tables inside Tables - HTML design trick


Making a web page look good and work on all Browsers is not easy. Especially if you are using javascript ;). But...how can you make a web page entirely out of tables, and make it perfect at the same time?
Creating tables one inside of each other and setting everything right can make wonders.
First you must make a table with the border of 0 (border="0") and make the with and height of the page (of the table) at 100% (width="100%" height="100%"). Also very important , you must always set the cellspacing and cellpadding to 0 (cellpadding="0" cellspacing="0"). The table will now look like this:

< border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
Right now, you have a table that is as wide and as tall as the browser's page is. now, very important, to continue, you must make the properties set to the center and aligned to the middle or the top like so:< align="center" valign="top">. Inside the <> you must place now another table just like the one in the first example, but you must get the width="100%" height="100%" out! so it will look like this:
< border="0" cellpadding="0" cellspacing="0">
Right now, you have a table including another table, and the second table is on the top center of the page. Once you add data to that table it will become wider. You can include as many tables as you want in the second one....and make as many separate <>'s as you want.
Including one table in the other is very useful. You can position any content where ever you want to. For example, if you want to make the top-center table of 400 width, you just set the width="400" of the <> that includes the table and the content of the table will now be wider.A very important thing once you set a width or a height property is....if you want the content to go down, in stead of right, you must set the nowrap="nowrap" . Try it!
Let me know if there are any questions ;).

Friday, February 23, 2007

How to add data in Mysql From Php

Adding information in the database (a mysql database) using PHP is not a hard thing at all...
You just use a function:

mysql_query(" ");
between " " you must add the mysql command that adds the information.
for example: you have a table named "user" that contains:
user name
password
How do you add information to mysql from the page you have?

Simple!

Let's say you have the information stored in the variables:
$user_name and $password
you just use the following command:

mysql_query("INSERT INTO `user` (`user_name`, `password) VALUES ('$user_name', '$password')");
user is the name of the table
you must put tables and rows and everything that is not a value in ``
you put values in ''
` is a character on the left of the 1 button on your keyboard !
' is the second one on the right of L button on your keybord
values are variables themselves!!!
you can also write the insertion like this:
mysql_query("INSERT INTO `user` (`user_name`, `password) VALUES ('".$user_name."', '".$password."')");
in order to make the variables $user_name and $password outside of the mysql_query function.

Textbox Date Validator - Javascript

I needed to validate 3 textboxes for making a date input on a web page., but I needed to verify the content that the user was entering in the webpages. So I came up with the following Javascript Function:

function text_check(id,x)
{

var text,i,value,status;
var nr = new Array()
nr[0]="0";
nr[1]="1";
nr[2]="2";
nr[3]="3";
nr[4]="4";
nr[5]="5";
nr[6]="6";
nr[7]="7";
nr[8]="8";
nr[9]="9";

text = document.getElementById(id).value;

text = text.substr(text.length-1);
i=0;

while(i<=10)
{
if(text!=nr[i])
{
value=false;
}
else
{
value=true;
break;
}
i++;
}

if(value!=true)
{
if(x=="true"){alert("You cannot imput "+text+" character! Only Numbers!");}
text = document.getElementById(id).value;
text = text.substr(0,text.length-1);
document.getElementById(id).value = text;
}

}

You just call it and enter the ID of the textbox. here is an example:

< id="birth_date_1" name="birth_date_1" onkeydown="text_check('birth_date_1','false')" onkeyup="text_check('birth_date_1','true')" onclick="text_check('birth_date_1','false')" style="width: 30px;" maxlength="2" type="text" width="30">

It does not look very pretty but it get's the job done. The long content can be placed in a dinamic PHP function that will make it more pretty.

Change Image, Change Collor

function changeImage(id,img)
{
newImage = "url("+img+")";
document.getElementById(id).style.backgroundImage = newImage;
}

function changeColor(id,color)
{
document..getElementById(id).style.backgroundImage = color;
}

2 JavaScript functions that modify the color or the image of an ID. You just need to set the ID and the path of the file or the color (Depending on the function). I guess the name of each function gives you the biggest hint .