 |
 |
|
|
| |
| |
| |
|
|
| Articles about Using Php |
| Performing Simple String Search Using PHP and MySQL | | 2008-07-30 01:55:04 | |
Here it is, a post after so long!
We see “Search” feature on almost all websites. Some employ third-party
tools (like Google Custom Search) while others, mostly CMS based websites, have
their own Search feature. The question now is, How do Search Feature Work? Answer
is, it (almost always) uses MySQL (or database server’s capability. You
all might be knowing that CMSs always store information in databases. So if
we can search that we can very well search the whole site!
So today we’re going to employ the feature of MySQL to perform simple
searching. As an example we’ll be creating an Online Phonebook to illustrate
this.
MySQL’s Simple Search (String Matching) Query
select [coulumn1] from [table] where [column2] like ‘$var%’
(For some of the basic SQL queries refer to MySQL
Commands)
we’ll take a simple example to illustrate the above query. Suppose we
have a table with the following rows and columns:
... | | By: Learning Computer Programming | | |
| | | Permanent (301) and Temporary (302) Redirection Using PHP | | 2008-06-01 01:17:02 | | Redirection is the method of forwarding users to a new domain or URL when they
try to reach the old one.
Suppose my friend Ralph had once created a website at:
ralphhaynes.com
and after sometime created yet another website on the sub domain:
blog.ralphhaynes.com
Now he wants to have his blog (second website) on a new separate domain name.
Since he already has lots of readers who visit the old URL, he has to find some
way to let them know the new URL. The easiest way yet the most effective would
be to use Redirection.
Actually, there are two types of redirection, permanent and temporary. In the
above case when Ralph wanted to permanently move to a new domain he should use
Permanent Redirection. In some other cases when webmasters have to move from,
say a domain to a sub domain due to some temporary problems they could use Temporary
Redirection.
301 Permanent Redirection
‘301’ here is the HTTP response code sent by the server to the
client. Server s... | | By: Learning Computer Programming | | |
|
|
|
| Slider Using PHP, Ajax And Javascript | | 2008-01-10 13:01:03 | | Have you been searching for the slider script and implementing it in Ajax with PHP then you are in the right place buddy. Ok let’s Begin it by creating the following tables in the database,
CREATE TABLE `tbl_slider` (
`id` smallint(6) NOT NULL auto_increment,
`slider_val` smallint(6) NOT NULL default ‘0′,
PRIMARY KEY [...]... | | By: PHP And Ajax Related Useful Resources and Codes | | |
| | A simple Class to export data to excel using PHP | | 2007-12-17 04:06:13 | | While generating a report in your project, you might have to download the data into excel file using PHP. In most scenario, you have to display the report in a page and create a link to download the report in the excel file. Well in that scenario, i think i can help you with a simplified class and code of PHP.I've created three files in my example.1) class.export_excel.php - This file contains the code to export data in excel.2) export_excel.php - This file contains the code to assign values of the excel header and excel data. The header is one-dimentional array. And the other one is the values to be exported and this one is two-dimentional array. And this file also contain the "fn" named get method ($_GET) varible , which is the name of the file to be generated. If a file called "daily_report.xls" is to be generated then this file can be called as "export_excel.php?fn=daily_report".3) test.php - This file contains the data to be displayed in the web page and the same one will be... | | By: PHP And Ajax Related Useful Resources and Codes | | |
| | sIFR2 - Custom fonts for your website using php class | | 2007-12-03 03:47:00 | | sIFR by default using JavaScript for customizing, but we have to write a long line for just customizing one element/tag (i.e <H1>).As you can see in above image there are a couple line with very long line to write. We can make it shot using php because the other sIFR option nearly the same for each line (look at the sWmode, sLlinkColor and other option). So i write a php code for make a simple sIFR code placement.Basically this php code just to write javascript codes in the pages where sIFR will be place.Write this script and save it with sIFR.php (or whatever name you like). Next you must include this page in every php page where you want the sIFR font show up. But first the pages must included the sIFR javascript and css between the <head> and </head> tag (Code : Look at below image).If you want to use the php class, simply write php code like this example.<?php$sIFR->element[] = ".gm| FiftiesHeavy.swf | #dedede";$sIFR->element[] = ".judul1| Fancy Footwork.... | | By: Computers & Networking | | |
|
|
|
| | Add Tabs to Your Web Interface Using PHP and CSS | | 2007-01-15 17:35:00 | | Use HTML and CSS to create a tabbed interface for your web application. Sometimes there is just too much data to put onto one web page. An easy way to break up a site (or even a content-heavy page) is to display it using tabs, where the data is broken up into subelements, each correlating to a named tab. Lucky for us, tabs are a piece of cake with PHP. The Code Save the code in Example 1 as index.php. Example 1. Using the tabs library to show a tabbed interface <?php require_once("tabs.php"); ?> <html> <head> <?php tabs_header(); ?> </head> <body> <div> <?php tabs_start(); ?> <?php tab( "Tab one" ); ?> This is the first tab. <?php tab( "Tab two" ); ?> This is the second tab. <?php tabs_end(); ?> </div> </body> </html> Next, code up a nice PHP and CSS library. Save the code in Example 2 as tabs.php. Example 2. Using PHP and some CSS to create user-friendly tabs <?php $tabs = array(); function tabs_header() { ?> <style type="text/css"> .tab { border-bottom: 1px solid black; text-align: center; font-family: arial, verdana; } .tab-active { border-left: 1px solid black; border-top: 1px solid black; border-right: 1px solid black; text-align: center; font-family: arial, verdana; font-weight: bold; } .tab-content { padding: 5px; border-left: 1px solid black; border-right: 1px solid black; border-bottom: 1px solid black; } </style> <?php } function tabs_start() { ob_start(); } function endtab() { global $tabs; $text = ob_get_clean(); $tabs[ count( $tabs ) - 1 ][ 'text' ] = $text; ob_start(); } function tab( $title ) { global $tabs; if ( count( $tabs ) > 0 ) endtab(); $tabs []= array( title => $title, text => "" ); } function tabs_end( ) { global $tabs; endtab( ); ob_end_clean( ); $index = 0; if ( $_GET['tabindex'] ) $index = $_GET['tabind... | | By: php webtutorial | | |
|
|
| |
 |
|
| |
| |
|
 |