954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

WAP+php

hi
i am trying to develop a site.i am using php and wml.this is my first program.can any one say why my below code is not woking

<?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>
<?
require_once('./common/dblayer1.php');
$query = "select * from login";
$result = mysql_query($query);
  while ($row = mysql_fetch_array($result)) 
  {
  echo $row[0];
  }
?> 
</card>
</wml>
queenc
Junior Poster
145 posts since Mar 2008
Reputation Points: 9
Solved Threads: 4
 
<?xml version="1.0" ?>


xml declaration so the php should look something like

<?php
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>
<?php /* declare script type short tags may be off other script languages may be available saves debugging later*/
require_once('./common/dblayer1.php');
$query = "select * from login";
$result = mysql_query($query);
  while ($row = mysql_fetch_array($result))  {  echo $row[0];  }
?> 
</card>
</wml>
<?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>
<?
require_once('./common/dblayer1.php');
$query = "select * from login";
$result = mysql_query($query);
  while ($row = mysql_fetch_array($result)) 
  {
  echo $row[0];
  }
?> 
</card>
</wml>
almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
 

Line 2: Start tag expected, '<' not found.
it is showing the above error

queenc
Junior Poster
145 posts since Mar 2008
Reputation Points: 9
Solved Threads: 4
 
<?xml version=\"1.0\" ?>
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1 EN "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card>
<?php
require_once('./common/dblayer1.php');
$query = "select * from login";
$result = mysql_query($query);  
while ($row = mysql_fetch_array($result))  {  echo $row[0];  }
?> </card></wml>


maybe

almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
 

Line 1: String not started expecting ' or "
Line 1: Malformed declaration expecting version
Line 1: Blank needed here
Line 1: parsing XML declaration: '?>' expected
Line 2: SystemLiteral " or ' expected
Line 2: PUBLIC, the Public Identifier is missing
Line 2: Space required after the Public Identifier
Line 2: SystemLiteral " or ' expected
Line 2: SYSTEM or PUBLIC, the URI is missing
Line 2: DOCTYPE improperly terminated
Line 2: Start tag expected, '<' not found
these are the errors.i am WAP proof to execute my code.plz do tell me whether i right

queenc
Junior Poster
145 posts since Mar 2008
Reputation Points: 9
Solved Threads: 4
 

try taking out the \ from first line. They don't belong there anymore.

Rayhan Muktader
Light Poster
30 posts since Oct 2006
Reputation Points: 28
Solved Threads: 3
 
try taking out the \ from first line. They don't belong there anymore.


forehead slap moment, Sorry

almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
 

You probably have short open tags enabled in the PHP config. So it would see the xml declaration as an opening PHP tag.

In PHP.ini disable short open tags by finding "short_open_tag" and making the value "0".

You can also seperate the < and ? in <?xml so it doesn't look like a PHP open tag (<?).

eg:

<?php
echo "<"."?xml version=\"1.0\" ?>";


notice that you have "<"."?xml instead of "<?xml.

You can also remove the xml declaration, and use the HTTP content-type header.

<?php

header('Content-Type: text/xml');
digital-ether
Nearly a Posting Virtuoso
Moderator
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You