WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Using MySQL ENCODE / DECODE with PHP & HTML
Categories : PHP, HTML and PHP, Databases, MySQL Click here to Update Your Picture
Dan Johnson
Date : Nov 05th 2000
Grade : 3 of 5 (graded 2 times)
Viewed : 37951
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Dan Johnson
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

This example uses the MySQL functions to encode and decode a string. The first
segment of the code encodes the string "testing" and stores the result in a
variable, while the second segment, decodes the coded variable back to its
original state.

A user should save this code as a PHP file and access it through a browser.

A use might be if you wanted to create a encoded password or something like
that, or store a code in a database instead of storing the actual word. The
decode part would then decode the stored information. You might notice that
the script:
Select ENCODE('testing','');
has a second argument that I left empty. You can use an additional password
or key in the second argument if you want to, but when you use the decode
function, the second argument or key must be the same as when it was encoded
or you will not get back the correctly decoded word.



//Sample by Daniel P. Johnson
//www.eyelightmedia.org


//=====================

<html>
<body>
<p>
<?php

$enc = mysql_query("SELECT ENCODE('testing','')");
$str_enc = mysql_fetch_array($enc);
$val_enc = $str_enc[0];
echo $val_enc."<br>\n";

$dec = mysql_query("SELECT DECODE('".$val_enc."','')");
$str_dec = mysql_fetch_array($dec);
$val_dec = $str_dec[0];
echo $val_dec;

?>
</p>

</body>
</html>



Paginating the mySQL data
Categories : PHP, Algorithms, Databases, MySQL, HTML and PHP
DDN FFA Network Script
Categories : PHP, MySQL, Complete Programs, HTML and PHP, Databases
PHP and MySQL scripting for Muyltiple CheckBoxes
Categories : HTML and PHP, MySQL, Databases, PHP
Pull Down Surfing - Surf on Change
Categories : Java Script, MySQL, HTML and PHP, PHP, Databases
A PHP useradmin for MySQL. Uploading is easy. The only thing you need is PHP and MySQL installed!
Categories : MySQL, Databases, PHP, HTML and PHP
Functions for loading images into a MySQL database and displaying them.
Categories : Graphics, HTML and PHP, MySQL, PHP, Databases
Dynamically generated pop-ups (Select items)
Categories : PHP, HTML and PHP, MySQL, Databases
dynamic table columns
Categories : PHP, HTML and PHP, Arrays, Databases, MySQL
Complex paging with no resultset limit
Categories : PHP, MySQL, Databases, Output Control, HTML and PHP
phpFormGenerator for Dynamic Form Generation from MySQL
Categories : PHP, PHP Classes, MySQL, Databases, HTML and PHP
Editing the virtusertable and sendmail.cw via PHP3.0 and Mysql
Categories : MySQL, HTML and PHP, PHP, Databases
This function will populate the options in a drop down HTML select list in a form from a database query.
Categories : MySQL, General SQL, PHP, HTML and PHP, Databases
Message of the Day - Random Message (Needs MySQL!)
Categories : Databases, HTML and PHP, PHP, MySQL
Required form fields that pull from MySQL database
Categories : PHP, HTML and PHP, Databases, MySQL
This program will take data from a user via a web based form, validate it, show it to the user for re-validation, and finally insert it into the database. Plenty of sanity checking on the fields in the form.
Categories : MySQL, HTML and PHP, PHP, Complete Programs, Databases