I'm trying to build a prototype for a client.
http://seattlewebtutor.com/testsql15.php
This is a basic mysql db to php output.
I want to output to wml.
Please, show me my errors...
tia,
David Larew
Do I need to escape all php/mysql?
My goal is to output address info, price, name, date,
time and a map to the passenger address/location...
<?php
Header("Content-type: text/vnd.wap.wml");
Header("Cache-Control: no-cache, must-revalidate");
Header("Pragma: no-cache");
echo ("<?xml version='1.0'?>");
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml" >
<wml>
<card id="card2" title="airtaxi">
<p>
<?php
$db = mysql_connect("localhost", "seattlewebtutor", "");
mysql_select_db("airtaxi",$db);
if ($id) {
if ($submit) {
$sql = "UPDATE employees SET first='$first',last='$last',address='$address',position='$position' WHERE id=$id";
$result = mysql_query($sql);
echo "Thank you! Information updated.\n";
} else {
// query the DB
$sql = "SELECT * FROM employees WHERE id=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<input type=hidden name="id" value="<?php echo $myrow["id"] ?>">
First name:<input type="Text" name="first" value="<?php echo $myrow["first"] ?>"><br>
Last name:<input type="Text" name="last" value="<?php echo $myrow["last"] ?>"><br>
Address:<input type="Text" name="address" value="<?php echo $myrow["address"] ?>"><br>
Position:<input type="Text" name="position" value="<?php echo $myrow["position"] ?>"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
}
} else {
// display list of employees
$result = mysql_query("SELECT * FROM employees",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<a href=\"%s?id=%s\">%s %s</a><br>\n", $PHP_SELF, $myrow["id"], $myrow["first"], $myrow["last"]);
}
}
?>
</p>
</card>
</wml>