ich habe versucht via php und wml daten von contenido für handys (WAP) anzuzeigen, was grundsätzlich mit meinen ersten tests auch gut gelungen ist. ich wollte nun die datensätze in einer tabelle auf dem handy angezeigt bekommen und da ohhh schreck scheiterte ich. damit ich mir da keine grauen haare wachsen lassen muss frage ich mal euch...

für alle die das mal versuchen wollen, nachfolgend der code von W.J. Gilmore.
1. einen folder z.b. wap auf euerm account erstellen
2. da eine .htaccess datei erstellen die so auschaut und in den wap folder kopieren
Code: Alles auswählen
AddType application/x-httpd-php .php .wml
DirectoryIndex index.wml
3. nun ein file index.wml mit dem funktionierenden code (unten) erstellen und ebenfalls in den wap folder kopieren.
4. der einfachheit halber habe ich mal eine testtabelle in meiner db erstellt mit nachfolgendm sql script und ein paar daten handisch via MySql controll o.ä. in diese tabelle eingefüllt
Code: Alles auswählen
mysql>create table soccer_scores (
>team1 char(20),
>score1 int,
>team2 char(20),
>score2 int );
fertig...
danke für euer tabellenproblem feedback.
grüsse bladi
Das ist der funktionierende script aber eben ohnen ausgabe in tabellen:
Code: Alles auswählen
<?php
// send wml headers
// Autor: W.J. Gilmore
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="dein Titel">
<p>
<?php
// connect to mysql database
$scores = mysql_pconnect("www.deine_URL.com", "DB_User","DB_Passwort");
// select database
$db = mysql_select_db("DB_Name");
// select information from sports db
$query = "select team1, score1,
team2, score2
from soccer_scores";
$result = @mysql_query($query);
print "<b>AUE Suchergebnis aus einer DB:</b> <br/><br/>";
// if information fitting the query is found,
// format and display it to the screen.
if (mysql_num_rows($result) > 0) :
while ($row = mysql_fetch_array($result)) :
print "$row[team1] $row[score1] $row[team2] $row[score2]<br/>";
endwhile;
// if no information fitting the query is found,
// display relevant message.
else:
print "No current results.";
endif;
?>
</p>
</card>
</wml>
Code: Alles auswählen
<?php
// send wml headers
// Autor W.J. Gilmore
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="dein Titel">
<p>
<?php
// connect to mysql database
$scores = mysql_pconnect("www.deine_URL.com", "dein_DB_username","dein_DB_passwort");
// select database
$db = mysql_select_db("dein_DB_name");
// select information from sports db
$query = "select team1, score1,
team2, score2
from soccer_scores";
$result = @mysql_query($query);
print "<b>AUE Suchergebnis aus einer DB:</b> <br/><br/>";
// if information fitting the query is found,
// format and display it to the screen.
if (mysql_num_rows($result) > 0) :
while ($row = mysql_fetch_array($result)) :
print '<table title="tabelle" columns="1" align="LL">
<tr><td> $row[team1] </td><td> $row[score1] </td></tr>
<tr><td> $row[team2] </td><td> $row[score2] </td></tr>
</table><br/>';
endwhile;
// if no information fitting the query is found,
// display relevant message.
else:
print "No current results.";
endif;
?>
</p>
</card>
</wml>