Thread: PHP WML Mysql
View Single Post

  #4 (permalink)  
Old 09-06-2004
Janwillem Borleffs
 
Posts: n/a
Default Re: PHP WML Mysql

Dom wrote:
> I understand the principles of WML. I was just wondering whether it is
> possible to easily convert this HTML page into a page that can be used
> for WAP. I have tried to make a few modifications to change it into a
> WML page, but I kept getting errors about the PHP.
>
> Any help would be greatly appreciated.
>


<?
header("Content-Type: text/vnd.wap.wml");
// In case open_short_tag support is enabled
print '<?xml version="1.0" encoding="iso-8859-1"?>'."\n";
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="myCard" title="Some title">
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$result = mysql_query("SELECT * FROM employees",$db);

printf("First Name: %s<br />\n", mysql_result($result,0,"first"));
printf("Last Name: %s<br />\n", mysql_result($result,0,"last"));
printf("Address: %s<br />\n", mysql_result($result,0,"address"));
printf("Position: %s<br />\n", mysql_result($result,0,"position"));

?>
</card>
</wml>


JW



Reply With Quote