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
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
Mobile Dev World

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 : 9933
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
Visits-tracking
Categories : PHP, Databases, MySQL, Errors and Logging, Functions
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
create a grid out of <INPUT TYPE=TEXT> then saving to a database. Uses a 'multi-dimension array', but not really as the array is just one big array with the index of "[$i][$j]". Have a look at the code and you'll see what I mean.
Categories : PHP, MySQL, Arrays, Databases
Password protection for Phorum 3.1.x with userlevels and log.
Categories : PHP, MySQL, Authentication, Security
AJAX Data Grid System using php and mysql. A complete login system with the ability to display data in a grid using ajax. Add , update and delete the records without reloading the page.
Categories : PHP, AJAX, Databases, MySQL, Java Script
Identify and log search engine access (spiders, robots, etc.) to a page.
Categories : HTTP, Environment Variables, PHP, MySQL, Databases
Finds the median in an array of numbers - Can be used with a MySql database column read into an array
Categories : PHP, Arrays, Databases, MySQL
Simple function to return the number of days in a time span between 2 given dates.
Categories : PHP, Date Time, MySQL, Databases
Amazon book cover handling
Categories : HTML and PHP, PHP, MySQL, Ecommerce
Solution to those 'tell-a-friend' type email issues
Categories : PHP, Email, Databases, MySQL
PostGreSQL and MySQL 2 in 1 db Manager
Categories : PHP, PHP Classes, Databases, PostgreSQL, MySQL
Complete, simple working example of login screen and check on a unique page using php functions, cookies and mysql database.
Categories : PHP, Cookies, MySQL, HTML and PHP, Authentication
[PHP5] aDB PDO LIKE Database Abstraction. Switch easily from one db server to another, strong errors management, manage transactions, queries preparation and more.
Categories : PHP, PHP Classes, Databases, MS SQL Server, MySQL
 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!