WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
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 Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
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
Submit Site
Forex Trading Online forex trading platform

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 : 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 Update Picture
Peter Garner
Date : Dec 05th 2000
Grade : 5 of 5 (graded 1 times)
Viewed : 7806
File : Phonelistdoc.txt
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 
 

// Phone List Search version 1
//
// Peter Garner (peterg@mildewhall.fsnet.co.uk)
// 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 last name (or part of a name) - d2a.wml.
// You can call it anything you like, but a short
// URL is easy on a phone keypad..

<?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="20"/>
<p align="center">
<strong><big>Phone List</big></strong>
<br/>
</p>
</card>

<card id="card1" title="Search">
<p>
<do type="accept" label="Search">
<go href="d2b.wml" method="post">
<postfield name="Lname" value="$Lname"/>
</go>
</do>
Enter Last Name:<br/>
<input title="Last Name" name="Lname" maxlength="40"/>
</p>
</card>
</wml>

// Once you have entered your search string, this deck is
// then accessed (d2b.wml). It uses a simple MySQL database
// called "Phonelist" and the table is called "mysite". If
// your phone supports it, you can use the WTAI to place a
// call to your "result" once you have hung up. Please note
// that this script doesn't do any checking for length of
// output. If it's over the limit you will get a 'malformed
// http' message or somthing similar.

<?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="card1" title="Result">
<p>
<?php
if ( $DBcon = mysql_connect("localhost", "","") )
{
mysql_select_db("Phonelist");
$query = "select Fname, Lname, Ext, Email, ";
$query .= "Dept, JobDesc from mysite ";
$query .= "where Lname like '%$Lname%'";

$result = mysql_query($query);
$nr = mysql_num_rows($result);

if ( !empty($Lname) )
{
if ( $nr > 0 )
{
for ($count = 1; $row = mysql_fetch_row ($result); ++$count)
{
$Fname = $row[0]; // first name
$Lname = $row[1]; // last name (search key)
$Ext = $row[2]; // phone extension
$Email = $row[3]; // email address
$Dept = $row[4]; // Department
$Job = $row[5]; // job description

echo "<i>$Fname $Lname</i><br/>";
echo "<strong><small> T.</small></strong>01xxx-xxx$Ext<br/>";
echo "<small><strong> E.</strong>$Email</small> ";
echo "<strong><small> Dept.</small></strong>$Dept ";
echo "<strong><small> Job.</small></strong>$Job<br/>";
echo "<anchor>Call $Fname";
echo "<go href=\"wtai://wp/mc;01xxxxxx$Ext\"/>";
echo "</anchor>";
}
}
else
{
echo "Sorry - no match for $Lname";
}
}
else
{
echo "Please select a name (or part thereof)";
}
@mysql_close($DBcon);
}
?>
<br/>
</p>
</card>
</wml>

// End of source. Enjoy !




Multi-table database search for your WAP-enabled device. Uses PHP and MySQL. No WMLscript.
Categories : WAP, WML, PHP, MySQL
bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager
Categories : MySQL, PHP, MySQL, Complete Programs, Databases
Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs.
Categories : Databases, PHP, MySQL, Complete Programs
Cut your MySQL Connections to 1 line of code
Categories : PHP, Beginner Guides, Databases, MySQL
a function that builds an HTML select list from any mysql table.
Categories : PHP, MySQL, HTML and PHP
phpAds, a complete banner and ad management system with detailled tracking and stats.
Categories : MySQL, Complete Programs, Ecommerce, PHP, Databases
Point and Click Interface ala MS Access for creating SQL statements.
Categories : MySQL, Complete Programs, General SQL, PHP, Databases
Displaying records of database in more than one page (paging)
Categories : Databases, MySQL, PHP
Message of the Day - Random Message (Needs MySQL!)
Categories : Databases, HTML and PHP, PHP, MySQL
Retrieve text from table and email to your e- address in pipe delimited format.
Categories : PHP, MySQL
A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL
Tropicalm Genetree Family (MySQL based family tree)
Categories : PHP, Interfaces, Databases, MySQL, Complete Programs
Report Generation in Microsoft Access from a MYSQL database
Categories : PHP, MySQL, Databases, MS Access
WML error handler for the Apache webserver.
Categories : PHP, WML, WAP
Automatically printing the contents of an sql table in MySQL.
Categories : MySQL, PHP, HTML and PHP, Databases
 joakim Stenebo wrote : 1004
Really nice!!! tobad im i suck at SQL im getting error mesages... prolly because i havent set up my database correctly... hav only coded .wml before
im getting some wierd error message pointing to 
 $nr = mysql_num_rows($result);
someone have a clue.... i dont?
 
 joakim Stenebo wrote :1005
hehe ! ok now after 1 hour or so that problem is solved ...
but now i have another
seems like whatever i input the code always do:
}
    else
        {
        echo "Please select a name (or part thereof)";
        }
        @mysql_close($DBcon);
    }

doesnt seem like the $Lname is working correctly or something!