Posts

Showing posts with the label PHP

Typeahead Implementation in PHP/MySQL

DEMO First, you need to include all the necessary files for this to work. Place these three files in the head section of your page.. jquery-1.10.2.min.js  bootstrap.min.js bootstrap3-typeahead.min.js Then, this script: $(document).ready(function () { var objects = []; var map = {}; $('#person').typeahead({ source: function (query, process) { $.ajax({ url: 'get_person.php', type: 'POST', dataType: 'JSON', async: true, success: function (data) { objects = []; //resets the objects map = {}; //to avoid duplication $.each(data, function (i, object) { map[object.full_name] = object; objects.push(object.full_name); }); process(objects); } }); }, //end source ...

Show Search Results in a Pop-up Div

Image
It uses MySQL as the database. Basically, the search results will pop up. Here's the code below:

Simple Log-in/Logout and Registration with Session and Blowfish Encryption

Image
This simple login and logout PHP script uses Blowfish Encryption for its password security here's the screenshot: Download Source Code Database Name: dblogin

Create A Simple Timestamp in PHP, MySQL

Image
Well, here's the screenshot 'coz I'm too lazy to explain it. Here's the code for reference: index.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Time Ago</title> <style> #stamp{ background-color:#CCCCCC; } </style> </head> <body> <p>Create a Database by clicking the button below then sign-up the form.</p> <form method="post" id="createdb" action="createdbandtables.php"> <input type="submit" class="submitdb" value="Create DB" /><br/> </form> <form action="reguser.php" method="post" name="userreg"> <table...

PHP: Displaying Paragraphs from MySQL Database

Image
Let the image explain: Without this function, the browser won't read the paragraph properly from MySQL Database. The new line will be ignored as shown in the image above (blue border).

Disable Submit/Save Button if Value Exists from MySQL Database

Image
As shown below: Download Source Code First you need to create a database and name it as "syllabus" then import the sql file from the source code. Here are the codes below for reference:

Showing and Hiding MySQL error in PHP

You might ask why we hide an error, 'cause it should be fixed right? Anyway, there are instances that we just need to hide it. Let's say for example, "undefined index" error/warning in this case: I have this table with unique attribute names in every "input" elements: ID Name 1 Eds 2 Matt We don't know how many value that the user will input, so I assume that he/she will always input eight(8) values. I must fetch the value from that table by assigning them to a variable. If the user will  input less than eight(8), a warning or error will show "undefined index..". In this case, I just hide it.

Simple Log-in/Logout and Registration in PHP with Sessions

Image
Before anything else, the interface is based on Facebook but it's on green. :D Anyway, I'm too lazy to post the codes here so I decided to just upload all the files and you can download it if you like.