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>

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.

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");

       };
?>

 

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

woooohooooooooooo

I think i solved it by changing it to

 

            echo'<TABLE><TR>

              <TD>'.$a['name'].'</TD>

      <TD>'.$a['amount'].'</TD>

         

              </TR></TABLE>';

 

 

by adding table to it :D

so solved for now  ;D

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");

       };

?>

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");

 

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");

 

i dont think that is the right select statement to select all tables in database, can anyone help ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.