Mobile Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsMobile ProgrammingMobile Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 5th, 2002, 09:25 AM
peterg22's Avatar
peterg22 peterg22 is offline
I Like Adnams Ale
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Alton, Hampshire, UK
Posts: 35 peterg22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 38 sec
Reputation Power: 11
Question 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 ?

Reply With Quote
Reply

Viewing: Dev Shed ForumsMobile ProgrammingMobile Programming > WML + PHP looping problem.

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap