oriental_express Posted December 20, 2007 Share Posted December 20, 2007 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> Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 20, 2007 Share Posted December 20, 2007 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. Quote Link to comment Share on other sites More sharing options...
oriental_express Posted December 20, 2007 Author Share Posted December 20, 2007 can you give me some sort of search term please ? thanks Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 20, 2007 Share Posted December 20, 2007 Search content-type and wml. Quote Link to comment Share on other sites More sharing options...
oriental_express Posted December 20, 2007 Author Share Posted December 20, 2007 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"); }; ?> Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 20, 2007 Share Posted December 20, 2007 I don't know WML, sorry. At least it's working better Quote Link to comment Share on other sites More sharing options...
oriental_express Posted December 20, 2007 Author Share Posted December 20, 2007 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 Quote Link to comment Share on other sites More sharing options...
oriental_express Posted December 20, 2007 Author Share Posted December 20, 2007 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 so solved for now Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 20, 2007 Share Posted December 20, 2007 Oh lol I didn't even look at it since I didn't notice the HTML in it. Yeah to do a table you need the table tag Quote Link to comment Share on other sites More sharing options...
oriental_express Posted December 21, 2007 Author Share Posted December 21, 2007 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"); }; ?> Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 21, 2007 Share Posted December 21, 2007 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"); Quote Link to comment Share on other sites More sharing options...
oriental_express Posted December 21, 2007 Author Share Posted December 21, 2007 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 ? Quote Link to comment Share on other sites More sharing options...
oriental_express Posted December 21, 2007 Author Share Posted December 21, 2007 anymore guesses please ? :-X Quote Link to comment Share on other sites More sharing options...
oriental_express Posted December 21, 2007 Author Share Posted December 21, 2007 anyone able to help ? thanks Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 21, 2007 Share Posted December 21, 2007 try $results = mysql_query("SELECT * FROM SUM(amount) ORDER BY name DESC"); Quote Link to comment Share on other sites More sharing options...
rarebit Posted December 21, 2007 Share Posted December 21, 2007 Just for your info, one or other of wap or wml is just html 1.0, here's some helps: tutorial reference Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.