WAP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreWAP 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:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old March 17th, 2005, 08:24 AM
utsboy utsboy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Jakarta
Posts: 16 utsboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 22 m 26 sec
Reputation Power: 0
Send a message via Yahoo to utsboy
PHP script error...

Dear Guys.. could any one help me, I would very appreciate it.
I've made this PHP script, its just a simple script.
It works in PHP, but my script wont work when I use WML.
with error message (Translation failed for content-type: text/vnd.wap.wml) in Upwave sdk.
Please help me.... Coz I dont have a clue.

<?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>
<card id="card1" title="Song List">
<p>
<?php

function pageBrowser($totalrows,$numLimit,$amm,$queryStr,$numBegin,$begin,$num) {

$larrow = "&nbsp;<< Prev ".$numLimit."&nbsp;"; //You can either have an image or text, eg. Previous
$rarrow = "&nbsp;Next ".$numLimit." >>&nbsp;"; //You can either have an image or text, eg. Next
$wholePiece = "Page: "; //This appears in front of your page numbers

if ($totalrows > 0) {
$numSoFar = 1;
$cycle = ceil($totalrows/$amm);
if (!isset($numBegin) || $numBegin < 1) {
$numBegin = 1;
$num = 1;
}
$minus = $numBegin-1;
$start = $minus*$amm;
if (!isset($begin)) {
$begin = $start;
}
$preBegin = $numBegin-$numLimit;
$preStart = $amm*$numLimit;
$preStart = $start-$preStart;
$preVBegin = $start-$amm;
$preRedBegin = $numBegin-1;
if ($start > 0 || $numBegin > 1) {
$wholePiece .= "<a href='?num=".$preRedBegin
."&numBegin=".$preBegin
."&begin=".$preVBegin
.$queryStr."'>"
.$larrow."</a>\n";
}
for ($i=$numBegin;$i<=$cycle;$i++) {
if ($numSoFar == $numLimit+1) {
$piece = "<a href='?numBegin=".$i
."&num=".$i
."&begin=".$start
.$queryStr."'>"
.$rarrow."</a>\n";
$wholePiece .= $piece;
break;
}
$piece = "<a href='?begin=".$start
."&num=".$i
."&numBegin=".$numBegin
.$queryStr
."'>";
if ($num == $i) {
$piece .= "</a><b>$i</b><a>";
} else {
$piece .= "$i";
}
$piece .= "</a>\n";
$start = $start+$amm;
$numSoFar++;
$wholePiece .= $piece;
}
$wholePiece .= "\n";
$wheBeg = $begin+1;
$wheEnd = $begin+$amm;
$wheToWhe = "<b>".$wheBeg."</b> - <b>";
if ($totalrows <= $wheEnd) {
$wheToWhe .= $totalrows."</b>";
} else {
$wheToWhe .= $wheEnd."</b>";
}
$sqlprod = " LIMIT ".$begin.", ".$amm;
} else {
$wholePiece = "Sorry, no records to display.";
$wheToWhe = "<b>0</b> - <b>0</b>";
}

return array($sqlprod,$wheToWhe,$wholePiece);
}


include("inc/begin.inc");

$scores = mysql_connect("$host","$user","$pass");
$db = mysql_select_db("$database");
$criterea = " WHERE catagory='06' AND mstate='0'";
$sql = "SELECT COUNT(*) AS totalrows FROM music";


$arr = mysql_fetch_array(mysql_query($sql));

$navigate = pageBrowser($arr[totalrows],4,4,"&name=value",$_GET[numBegin],$_GET[begin],$_GET[num]);
$sql = "SELECT smid,singer,title FROM music".$criterea.$navigate[0];
$rs = mysql_query($sql);
echo "<p>Listing ".$navigate[1]." of ".$totalrows." results.</p>";
echo "<p>".$navigate[2]."</p>";
while ($arr = mysql_fetch_array($rs)) {
echo $arr[smid]." ".$arr[singer]." ".$arr[title]."<br>";
}
echo "<p>".$navigate[2]."</p>";

?>
</p>
</wml>

Reply With Quote
  #2  
Old March 18th, 2005, 06:32 AM
youngson youngson is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 17 youngson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 40 m 12 sec
Reputation Power: 0
You are missing </card> before the </wml>

Reply With Quote
  #3  
Old March 18th, 2005, 11:57 PM
utsboy utsboy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Jakarta
Posts: 16 utsboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 22 m 26 sec
Reputation Power: 0
Send a message via Yahoo to utsboy
Quote:
Originally Posted by youngson
You are missing </card> before the </wml>

Dear Guys, I've already add wml close tag </wml>.
But still not work.
Do I miss something in my script..
If I check on upsdk error message description it appears (below)..
But I still dont understand what it is..
Please tell me what I should do to myscript.. I would be very appreciate it..
N special thx to youngson for the input.. thx bro..

Regards,
Utsboy

WML translation failed.
(9) : error: Invalid element 'p' in content of 'p'. Expected PCDATA | em | stron
g | b | i | u | big | small | br | img | anchor | a | table | input | select | f
ieldset | do
(9) : error: Invalid element 'p' in content of 'p'. Expected PCDATA | em | stron
g | b | i | u | big | small | br | img | anchor | a | table | input | select | f
ieldset | do
(9) : error: Entity reference syntax error num
(9) : error: Entity reference syntax error numBegin
(9) : error: Entity reference syntax error name
(9) : error: Attribute 'href' is required
(10) : error: Entity reference syntax error num
(10) : error: Entity reference syntax error numBegin
(10) : error: Entity reference syntax error name
(11) : error: Entity reference syntax error num
(11) : error: Entity reference syntax error numBegin
(11) : error: Entity reference syntax error name
(12) : error: Entity reference syntax error num
(12) : error: Entity reference syntax error numBegin
(12) : error: Entity reference syntax error name
(13) : error: Entity reference syntax error num
(13) : error: Entity reference syntax error begin
(13) : error: Entity reference syntax error name
(15) : error: Expected tag end(>) instead of 0
(15) : error: Expected </ instead of TEXT '010600129 Aa Gym Jagalah Hati'
(15) : error: Invalid element 'PCDATA' in content of 'br'. Expected closing tag
(15) : error: Invalid element 'br' in content of 'br'. Expected closing tag
(15) : error: Expected tag end(>) instead of 0
(15) : error: Expected </ instead of TEXT '010600288 AB 3 Berikan Untukku_2'
(15) : error: Invalid element 'PCDATA' in content of 'br'. Expected closing tag
(15) : error: Invalid element 'br' in content of 'br'. Expected closing tag
(15) : error: Expected tag end(>) instead of 0
(15) : error: Expected </ instead of TEXT '010600068 ab3 suaramu'
(15) : error: Invalid element 'PCDATA' in content of 'br'. Expected closing tag
(15) : error: Invalid element 'br' in content of 'br'. Expected closing tag
(15) : error: Expected </ instead of start tag(<)
(15) : error: Invalid element 'p' in content of 'br'. Expected closing tag
(15) : error: Entity reference syntax error num
(15) : error: Entity reference syntax error numBegin
(15) : error: Entity reference syntax error name
(15) : error: Attribute 'href' is required
(16) : error: Entity reference syntax error num
(16) : error: Entity reference syntax error numBegin
(16) : error: Entity reference syntax error name
(17) : error: Entity reference syntax error num
(17) : error: Entity reference syntax error numBegin
(17) : error: Entity reference syntax error name
(18) : error: Entity reference syntax error num
(18) : error: Entity reference syntax error numBegin
(18) : error: Entity reference syntax error name
(19) : error: Entity reference syntax error num
(19) : error: Entity reference syntax error begin
(19) : error: Entity reference syntax error name
(23) : error: Close tag 'card' does not match start tag 'br'
(24) : error: Close tag 'wml' does not match start tag 'br'
(25) : error: Expected the end tag 'br' instead of end of file

Reply With Quote
  #4  
Old March 19th, 2005, 09:29 AM
G00SE's Avatar
G00SE G00SE is offline
.... escape ....
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 448 G00SE User rank is Sergeant (500 - 2000 Reputation Level)G00SE User rank is Sergeant (500 - 2000 Reputation Level)G00SE User rank is Sergeant (500 - 2000 Reputation Level)G00SE User rank is Sergeant (500 - 2000 Reputation Level)G00SE User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 19 h 42 m 8 sec
Reputation Power: 11
<?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>
<card id="card1" title="Song List">
<p>
<?php

function pageBrowser($totalrows,$numLimit,$amm,$queryStr,$numBegin,$begin,$num) {

$larrow = "&nbsp;<< Prev ".$numLimit."&nbsp;"; //You can either have an image or text, eg. Previous
$rarrow = "&nbsp;Next ".$numLimit." >>&nbsp;"; //You can either have an image or text, eg. Next
$wholePiece = "Page: "; //This appears in front of your page numbers

if ($totalrows > 0) {
$numSoFar = 1;
$cycle = ceil($totalrows/$amm);
if (!isset($numBegin) || $numBegin < 1) {
$numBegin = 1;
$num = 1;
}
$minus = $numBegin-1;
$start = $minus*$amm;
if (!isset($begin)) {
$begin = $start;
}
$preBegin = $numBegin-$numLimit;
$preStart = $amm*$numLimit;
$preStart = $start-$preStart;
$preVBegin = $start-$amm;
$preRedBegin = $numBegin-1;
if ($start > 0 || $numBegin > 1) {
$wholePiece .= "<a href='?num=".$preRedBegin
."&numBegin=".$preBegin
."&begin=".$preVBegin
.$queryStr."'>"
.$larrow."</a>\n";
}
for ($i=$numBegin;$i<=$cycle;$i++) {
if ($numSoFar == $numLimit+1) {
$piece = "<a href='?numBegin=".$i
."&num=".$i
."&begin=".$start
.$queryStr."'>"
.$rarrow."</a>\n";
$wholePiece .= $piece;
break;
}
$piece = "<a href='?begin=".$start
."&num=".$i
."&numBegin=".$numBegin
.$queryStr
."'>";
if ($num == $i) {
$piece .= "</a><b>$i</b>";
} else {
$piece .= "$i";
}
$piece .= "</a>\n";
$start = $start+$amm;
$numSoFar++;
$wholePiece .= $piece;
}
$wholePiece .= "\n";
$wheBeg = $begin+1;
$wheEnd = $begin+$amm;
$wheToWhe = "<b>".$wheBeg."</b> - <b>";
if ($totalrows <= $wheEnd) {
$wheToWhe .= $totalrows."</b>";
} else {
$wheToWhe .= $wheEnd."</b>";
}
$sqlprod = " LIMIT ".$begin.", ".$amm;
} else {
$wholePiece = "Sorry, no records to display.";
$wheToWhe = "<b>0</b> - <b>0</b><br/>";
}

return array($sqlprod,$wheToWhe,$wholePiece);
}


include("inc/begin.inc");

$scores = mysql_connect("$host","$user","$pass");
$db = mysql_select_db("$database");
$criterea = " WHERE catagory='06' AND mstate='0'";
$sql = "SELECT COUNT(*) AS totalrows FROM music";


$arr = mysql_fetch_array(mysql_query($sql));

$navigate = pageBrowser($arr[totalrows],4,4,"&name=value",$_GET[numBegin],$_GET[begin],$_GET[num]);
$sql = "SELECT smid,singer,title FROM music".$criterea.$navigate[0];
$rs = mysql_query($sql);
echo "Listing ".$navigate[1]." of ".$totalrows." results.</p>";
echo "<p>".$navigate[2]."</p>";
while ($arr = mysql_fetch_array($rs)) {
echo "<p>".$arr[smid]." ".$arr[singer]." ".$arr[title]."<br/>";
}
echo "".$navigate[2]."</p>";

?>
</card>
</wml>

Try that.

Reply With Quote
  #5  
Old March 19th, 2005, 04:00 PM
utsboy utsboy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Jakarta
Posts: 16 utsboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 22 m 26 sec
Reputation Power: 0
Send a message via Yahoo to utsboy
Re: PHP Script Error..

Dear Guys, I've also tried what Goose suggested..
But came out with no result..
But special Thx to Goose for the input... Thx Bro..
Is it something about wml rules that I missed in my script....
Or how to find out where is the mistake in my script..
Sorry because Iam just a beginner... in wml..
Caused I've been changing my php script and it always worked without wml, but when I embedded to wml it always error... Fyuuh
I dont have a clue...

Regards,
utsboy

Reply With Quote
  #6  
Old March 20th, 2005, 03:31 AM
G00SE's Avatar
G00SE G00SE is offline
.... escape ....
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 448 G00SE User rank is Sergeant (500 - 2000 Reputation Level)G00SE User rank is Sergeant (500 - 2000 Reputation Level)G00SE User rank is Sergeant (500 - 2000 Reputation Level)G00SE User rank is Sergeant (500 - 2000 Reputation Level)G00SE User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 19 h 42 m 8 sec
Reputation Power: 11
Basic rule to follow.

<p>must have a </p>

<p>can have<br/>
notice the way it wrote</p>

you can not have<br>

<br/><p>something is also wrong</p>

<p><b><u>bold underline text</u></b></p>

<p><u><b>this is invalid text</u></b></p>

they seem to be most of the problems in your code.

Basicly if you open a tag you must close the tag, the order they open in is the order they close.

Reply With Quote
  #7  
Old March 20th, 2005, 06:28 PM
utsboy utsboy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Jakarta
Posts: 16 utsboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 22 m 26 sec
Reputation Power: 0
Send a message via Yahoo to utsboy
Re: PHP script error

Dear Guys, thx for the input especially for Goose... Thx Bro
Even I havent found out the problems yet..
Could you guys tell me about the error message more what is it mean..??
Caused I still confused how to figure it out in UPSDK...
Like..:
(9) : error: Entity reference syntax error num
(9) : error: Entity reference syntax error numBegin
(9) : error: Entity reference syntax error name

(9) what is it mean...?
Is it mean row/line 9.. is the error.. ??
N.. is it mean row/line 9 from the top or what...??
Caused if in PHP it will tell us what line is the problem.....

Caused it seems there is a lot of difference between wml syntax and PHP.
To anyone who can show me what the problem is please inform me... caused I still confused about the errors.

Regards,
Utsboy,



Quote:
Originally Posted by G00SE
Basic rule to follow.

<p>must have a </p>

<p>can have<br/>
notice the way it wrote</p>

you can not have<br>

<br/><p>something is also wrong</p>

<p><b><u>bold underline text</u></b></p>

<p><u><b>this is invalid text</u></b></p>

they seem to be most of the problems in your code.

Basicly if you open a tag you must close the tag, the order they open in is the order they close.

Reply With Quote
  #8  
Old March 21st, 2005, 06:10 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,670 jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 4 Days 6 h 4 m 26 sec
Reputation Power: 1618
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
Have you got this online somewhere?
Most likely to do with &'s not being written out in full: &.
PHP Code:
<?php
// your code
$piece "<a href='?begin=".$start
."&num=".$i
."&numBegin=".$numBegin
.$queryStr
."'>";
// should be
$piece "<a href='?begin=".$start
."&num=".$i
."&numBegin=".$numBegin
.$queryStr
."'>";
__________________
Cheers,

Jamie


# skiFFie | Home of the 'accessibility module' for Drupal
# Jamie Burns [me] Accessibility Module [drupal]
# guidelines | search | wap resources | not getting help | fold to cure

# Any form of employment is strictly prohibited ......


__________________

Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.

__________________

Last edited by jabba_29 : March 21st, 2005 at 01:10 PM.

Reply With Quote
  #9  
Old March 21st, 2005, 04:16 PM
utsboy utsboy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Jakarta
Posts: 16 utsboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 22 m 26 sec
Reputation Power: 0
Send a message via Yahoo to utsboy
Thumbs up Re: PHP Script Error

Dear Guys,.. thx for u all especially to Jabba..
Thx Bro for the input its a brillian input..
I never thought about it, small but deadly..
It teached me alot..
It seems even we embedded php to wml it doesnt mean we can applied php just that...
Thx one more time..

Quote:
Originally Posted by jabba_29
Have you got this online somewhere?
Most likely to do with &'s not being written out in full: &.

Reply With Quote
  #10  
Old March 22nd, 2005, 08:14 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,670 jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 4 Days 6 h 4 m 26 sec
Reputation Power: 1618
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
No problem. I actually checked you code and edited my post to include the problem part. I thought that this was the issue even without looking at your snippet. It is a very common mistake

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreWAP Programming > PHP script error...


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