
December 5th, 2002, 09:25 AM
|
 |
I Like Adnams Ale
|
|
Join Date: Dec 2002
Location: Alton, Hampshire, UK
Posts: 35
Time spent in forums: 2 m 38 sec
Reputation Power: 6
|
|
WML + PHP looping problem.
I have written a WML page (pl4a.wml) that will read the first 10 entries from a database and display them 1 at a time: essentially it's a Top 10 chart see code below. Every time a new page is displayed, clicking the left button on my phone reloads the same page after incrementing the pointer by 1.
In order to save screen space I used the card title attribute as the "at number ...". When I get to number 11, I want to change the title to something else, but I can't do it.
Code:
<?php
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<template>
<do type="prev" label="Previous">
<prev/>
</do>
</template>
<card id="card2" title="@ Number <?php print ( $pointer + 1 ); ?> ..">
<p>
<?php
function NextMatch($z)
{
echo "<small><strong>";
echo "<anchor>+";
echo "<go href=\"pl4a.wml\" method=\"post\">";
echo "<postfield name=\"pointer\" value=\"$z\"/>";
echo "</go>";
echo "</anchor>";
echo "</strong></small>";
}
if ( $pointer <= 9 ) // remember we start from 0
{
error_reporting(0);
mysql_connect("localhost", "zzzzzz","iiiiiiii");
mysql_select_db("somedb");
$query = "select a,b,c .............
NextMatch($pointer + 1);
$pointer++;
$row = mysql_fetch_array($result);
echo "'$A......
echo "<br/>";
NextMatch($pointer);
echo "<br/>";
@mysql_close();
}
echo "<anchor>Return";
echo "<go href=\"index.wml\"/> ";
echo "</anchor>";
?>
</p>
</card>
</wml>
Now I know that once I have reached 11 and come out of the loop the "return" is displayed and my only option is to go back to index.wml, but if I try and change the title by putting another card block in it is just ignored. Any ideas ?
|