|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
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 = " << Prev ".$numLimit." "; //You can either have an image or text, eg. Previous $rarrow = " Next ".$numLimit." >> "; //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> |
|
#2
|
|||
|
|||
|
You are missing </card> before the </wml>
|
|
#3
|
|||
|
|||
|
Quote:
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 |
|
#4
|
||||
|
||||
|
<?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 = " << Prev ".$numLimit." "; //You can either have an image or text, eg. Previous $rarrow = " Next ".$numLimit." >> "; //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. |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
||||
|
||||
|
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. |
|
#7
|
|||
|
|||
|
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:
|
|
#8
|
||||
|
||||
|
Have you got this online somewhere?
Most likely to do with &'s not being written out in full: &. PHP Code:
__________________
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. |
|
#9
|
|||
|
|||
|
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:
|
|
#10
|
||||
|
||||
|
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
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > WAP Programming > PHP script error... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|