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 : Multi-table database search for your WAP-enabled device. Uses PHP and MySQL. No WMLscript.
Categories : WAP, WML, PHP, MySQL Update Picture
Peter Garner
Date : Dec 12th 2000
Grade : 1 of 5 (graded 5 times)
Viewed : 13504
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Peter Garner
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

// Chart Search version 1
//
// Peter T Garner.
// Uses PHP and MySQL.
// This works fine on my Mitsubishi Trium. YMMV.
// I developed this on the Linux version of the
// deckit emulator from www.pyweb.com.
//
// This is the first deck that prompts you for
// a chart (table), then a (book) Isbn to search for.
//
// N.B ******************
// The decks detailed below serve to illustrate
// how WML can be combined with PHP and MySQL to
// enable WAP-enabled devices to select and display
// data from a multi-table database. I used book chart
// data from my employer, Whitaker BookTrack (see
// http://www.booktrack.co.uk) as part of a pilot project.
// Currently, there is no WAP based service from Whitaker
// BookTrack, but this may change in the near future. Please
// contact me at peterg@teleord.co.uk for more information.

<?php
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\" ?>";
?>
<!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD WML 1.1//EN"
"http://www.phone.com/dtd/wml11.dtd" >
<wml>

<template>
<do type="prev" label="Previous">
<prev/>
</do>
</template>

<card id="card0" ontimer="#card1">
<timer name="key" value="30"/>
<p align="center">
<strong><big>ChartSearch..</big></strong>
<br/>
from <strong><big>BookTrack</big></strong>
<br/>
<small>
<i>
For Charts on the Move !
</i>
</small>
</p>
</card>

<!-- chart select -->

<card id="card1" title="Selector">
<p>
Please select a chart from the list:<br/>
<?php
if ( $DBcon = mysql_connect("localhost", "","") )
{
$result = mysql_list_tables("chart");
$i = 0;
echo "<select name=\"myChart\">";
while ($i < mysql_num_rows ($result) )
{
$tn[$i] = mysql_tablename ($result, $i);
echo "<option value=\"$tn[$i]\">$tn[$i]";
echo "</option>";
$i++;
}
echo "</select>";
}
mysql_close($DBcon);
?>

<do type="accept" label="Proceed">
<go href="#card2" method="post">
</go>
</do>
</p>
</card>

<!-- enter search data -->

<!-- We only want digits 1-9 of the Isbn as it will be
unique in the database without the check digit. If
we assume a match for the Isbn, the check digit will
be added when the result is returned.
Note the 2 postfield statements that will pass on the 2
variables that we collect on the way. We need to post
them now as we are going to leave this deck after we
enter the ISBN -->

<card id="card2" title="Search">
<p>
<do type="accept" label="Search">
<go href="c2b.wml" method="post">
<postfield name="Isbn" value="$Isbn"/>
<postfield name="myChart" value="$myChart" />
</go>
</do>

Enter Isbn:<br/>
<input title="Isbn" name="Isbn" size="9" maxlength="9" format="NNNNNNNNN"/>
</p>
</card>
</wml>

// Once you have selected your database table and entered
// your search string, this deck is then accessed (c2b.wml).
// It uses a simple MySQL database called "Charts" and the
// tables are named according to the week they relate to.
// Please note that this script doesn't do any checking for
// length of output. If it's over the limit you will probably
// get a 'malformed http' message or something similar. This
// will be tidied up in the next version..

<?php
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\" ?>";
?>
<!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD WML 1.1//EN"
"http://www.phone.com/dtd/wml11.dtd" >
<wml>

<template>
<do type="prev" label="Go Back">
<prev/>
</do>
</template>

<card id="card2" title="Result">
<p>
<?php
if ( !empty($Isbn) )
{
if ( $DBcon = mysql_connect("localhost", "","") )
{
mysql_select_db("chart");

$query = "select ISBN, cPosition, Author, Title, ";
$query .= " RRP, ASP, WeeksIn, PrevPos, Imprint from ";
$query .= $myChart;
$query .= " where ISBN like '$Isbn%'";

$result = mysql_query($query);
$row = mysql_fetch_array($result);
if ( $row )
{
//
// we need to change any ampersands to '+'
//
$TI = strtr($row[Title], "&", "+");
$AU = strtr($row[Author], "&", "+");
//
// sometimes, an author is not listed on the database
//
if ( empty($row[Author])) { $AU = "unknown"; }
//
// we need to change any ampersands to '+'
//
$AU = explode (",", $AU);
$PU = strtr($row[Imprint], "&", "+");
//
// now we will display our result.. We swap the first
// and last names of the author to produce a user-friendly
// display.
//
echo "Isbn $row[ISBN] is '$TI' by '$AU[1] $AU[0]' with an ";
echo "RRP of #$row[RRP]. ";
echo "Currently it is at number $row[cPosition]. ";
//
// A more user-friendly display of new entries..
//
if ( $row[WeeksIn] == '0' )
{
echo "This is a new entry in the charts. ";
}
else
{
echo "It has been in the charts for ";
echo "$row[WeeksIn] ";
echo "weeks. ";
echo "Last week it was at number ";
echo "$row[PrevPos]. ";
}
// Say who publishes it ..
echo "It is published by $PU. ";
echo "The typical street price is #$row[ASP]";
//
// And show a disclaimer along with the tablename
// that we used..
//
echo "<br/><br/><small>(C) BookTrack " . date('Y') . "<br/>E&OE</small>";
echo "<br/><small>$myChart</small>";
}
else
{
echo "Sorry<br/>No match for $Isbn";
}
mysql_close($DBcon);
}
}
else
{
echo "You can't have an empty ISBN";
}
?>
<br/>
</p>
</card>
</wml>




Sample WML Mailer
Categories : PHP, WAP, WML, Email
Simple phone list search for your WAP device. Uses PHP and MySQL. Also lets you dial out to your entries using wtai://wp/mc if your phone supports it. No WMLscript.
Categories : PHP, MySQL, WAP
wap device's headers on-line on wap phone
Categories : WAP, WML, PHP
php embeded with wml ,wmlscript ,simple example U can add mysql
Categories : WAP, PHP, WML
WML error handler for the Apache webserver.
Categories : PHP, WML, WAP
bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager
Categories : MySQL, PHP, MySQL, Complete Programs, Databases
free, search engine, indexing, system, information, web, ftp, http, free, software, cgi, php, MySQL, database, php3, FreeBSD, Linux, Unix, UdmSearch
Categories : MySQL, Complete Programs, PHP, Databases, Search
Identify and log search engine access (spiders, robots, etc.) to a page.
Categories : HTTP, Environment Variables, PHP, MySQL, Databases
Required form fields that pull from MySQL database
Categories : PHP, HTML and PHP, Databases, MySQL
DB Connection Function with error handling and email failure notices
Categories : PHP, MySQL, Errors and Logging, Databases, Errors and Logging
A simple script to count and report hits and the last modification time of an HTML page. Requires MySQL support (other DBs should work too, except possibly mSQL).
Categories : HTTP, MySQL, PHP, Databases
Displaying records of database in more than one page (paging)
Categories : Databases, MySQL, PHP
Free For All Links Page using PHP3 and Mysql
Categories : PHP, MySQL, Complete Programs
PHP Based Apache + Mysql Error Log Parser
Categories : PHP, PHP Classes, Apache, MySQL, Log Files
phpCards - PHP/mySQL postcard script with web based admin to add, edit, and delete cards and categories. Very easy to install.
Categories : PHP, Complete Programs, HTML and PHP, MySQL