Jump to content

PHP wont display properly for my WML files


oriental_express

Recommended Posts

Hi there eveyone im having abit of a problem

Im not sure if its correct to have php embedded into wml  or

just better to use php to display records. Any how this is

not working for some reason. Any ideas that could help ?

Thanks

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

<wml>
  <card id="page1" title="Total donations">
    <p>
      <table columns="3" align="LCR">
        <tr>
          <td>Name</td>
          <td>Amount donated</td>
        </tr>
    </table>
       <br/><br/>
           </p>

<?PHP



   mysql_pconnect('localhost','admin','admin');



   mysql_select_db("wml");

   $results = mysql_query("SELECT * FROM wwf ORDER BY name");

   if ($results){

       while ($a = mysql_fetch_array($results)) {

          echo'<TR>
              <TD>'.$a['name'].'</TD>
      <TD>'.$a['amount'].'</TD>
           
              </TR>';
       };

       print("</TABLE>");

       } else {

       print("No results to display");

       };



?>

              <p>
              <a href="menu.wml#main">Main menu</a>
              </p>
</card>
</wml>

Link to comment
Share on other sites

I think you will have to use PHP to generate the wml, so it will have a .php extension. That is the only way to run php code, with a .php . You would generate the type of the content using:

<?php

header("Content-type: text/css");

?>

 

Only I don't know what you'd put for wml files. I bet you can find a list somewhere though.

Link to comment
Share on other sites

ive manged to get the simulator to display records

but they are being displayed wrong . My desired format is 

 

Name      Amount

xxxxxxx  xxxxxxx

but its giving

 

xxxxxx

xxxxxx

xxxxxx

xxxxxx

 

I know im missing some wml code , could someone point me in the right direction

 

<?PHP

mysql_pconnect('localhost','admin','admin');

  mysql_select_db("wml");

   $results = mysql_query("SELECT * FROM wwf, ORDER BY name");

   if ($results){

       while ($a = mysql_fetch_array($results)) {

          echo'<TR>
              <TD>'.$a['name'].'</TD>
      <TD>'.$a['amount'].'</TD>
           
              </TR>';
       };

       print("</TABLE>");

       } else {

       print("No results to display");

       };
?>

 

Link to comment
Share on other sites

I don't know WML, sorry. At least it's working better ;)

 

yeah i guess.  cause right now it should be

 

michael  23

mary      34

joe        33

 

but its giving

 

michael

23

mary

23

joe

33

 

I can understand why because that is what the php code says it will do but can anyone add wml tables to it so that i can display it as

Name      amount

michael      23

mary        34

joe            33

 

thank you

Link to comment
Share on other sites

Am not gettin any luck in the mysql part of the forum so maybe i might here.

This time im trying to write the correct sql statements to display all the tables

names in the database along with the SUM for one of the columns for each table ie 'amount'

 

<?PHP

   mysql_pconnect('localhost','admin','admin');

   mysql_select_db("wml");

   $results = mysql_query("SELECT * TABLES SUM(amount) ORDER BY name");

   if ($results){

       while ($a = mysql_fetch_array($results)) {

          echo'<TABLE><TR>
              <TD>'.$fetch['name'].'</TD>
              <TD>'.$fetch['amount'].'</TD>
     </TR></TABLE>';
       };

       print("</TABLE>");

       } else {

       print("No results to display");

       };

?>

Link to comment
Share on other sites

Am not gettin any luck in the mysql part of the forum so maybe i might here.

This time im trying to write the correct sql statements to display all the tables

names in the database along with the SUM for one of the columns for each table ie 'amount'

 

<?PHP

   mysql_pconnect('localhost','admin','admin');

   mysql_select_db("wml");

   $results = mysql_query("SELECT * TABLES SUM(amount) ORDER BY name");

   if ($results){

       while ($a = mysql_fetch_array($results)) {

          echo'<TABLE><TR>
              <TD>'.$fetch['name'].'</TD>
              <TD>'.$fetch['amount'].'</TD>
     </TR></TABLE>';
       };

       print("</TABLE>");

       } else {

       print("No results to display");

       };

?>

 

 

 

 

You have to provide the query with a DESC, or ASC, after ORDER BY

 

   $results = mysql_query("SELECT * TABLES SUM(amount) ORDER BY name DESC");

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.