[PHP] simple querying mysql in a WML card problem :(

2001-04-25 Thread Sandeep Hundal

hi all!

i'm trying to get simple 2 line results from mysql in a wml card, but
i can't seem to manage it. here's my code:


?
header(Content-type: text/vnd.wap.wml); 
header(Cache-Control: no-cache, must-revalidate); 
header(Pragma: no-cache); 
echo (?xml version='1.0'?); 
? 

!DOCTYPE wml PUBLIC -//WAPFORUM//DTD WML 1.1//EN 
http://www.wapforum.org/DTD/wml_1.1.xml;;


?
include (db.php);
$query1 = SELECT club FROM table WHERE day='monday' ; 

echo 
wml   
card id=card1 title=clubbing by day 
p;

$result1 = mysql_query($query1);
if ($result1) {
echo  $day br;
while ($r1 = mysql_fetch_array($result1)) {
extract($r1);
echo $clubdetails br;
}
}

mysql_free_result($result1);

echo   /p
/card   
/wml;

?

simple? yet all it seems to give m is :

; = mysql_query( if ( { echo  
; while ( = mysql_fetch_array( { extract( echo  
; } }mysql_free_result( 
-

in my emulator (WinWAP).

Any help greatly appreciated!

/sandeep


Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] simple querying mysql in a WML card problem :(

2001-04-25 Thread James, Yz

Hi Sandeep,

The br tag looks like this in wml: br/

Have you escaped the doublequotes correctly in your double quoted echo 's?

Make sure that the database doesn't contain ampersands, or dollar signs, or
some of the foreign lettering (like é), as they are illegal characters in
wml (well, the dollar sign is used for variables, like PHP, but WML can't
accept them as part of a string as PHP does).

Ways to work around:

$string = ereg_replace(, , $string);

or

$string = ereg_replace(, amp;, $string);

To get a dollar, use two dollars:

$string = ereg_replace($, $$, $string);

That's about as much I can suggest, without actually playing with the script
myself  And I am too tired for that. :)

James

Sandeep Hundal [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 hi all!

 i'm trying to get simple 2 line results from mysql in a wml card, but
 i can't seem to manage it. here's my code:


 ?
 header(Content-type: text/vnd.wap.wml);
 header(Cache-Control: no-cache, must-revalidate);
 header(Pragma: no-cache);
 echo (?xml version='1.0'?);
 ?

 !DOCTYPE wml PUBLIC -//WAPFORUM//DTD WML 1.1//EN
 http://www.wapforum.org/DTD/wml_1.1.xml;;


 ?
 include (db.php);
 $query1 = SELECT club FROM table WHERE day='monday' ;

 echo 
 wml
 card id=card1 title=clubbing by day
 p;

 $result1 = mysql_query($query1);
 if ($result1) {
 echo  $day br;
 while ($r1 = mysql_fetch_array($result1)) {
 extract($r1);
 echo $clubdetails br;
 }
 }

 mysql_free_result($result1);

 echo  /p
 /card
 /wml;

 ?

 simple? yet all it seems to give m is :
 
 ; = mysql_query( if ( { echo 
 ; while ( = mysql_fetch_array( { extract( echo 
 ; } }mysql_free_result( 
 -

 in my emulator (WinWAP).

 Any help greatly appreciated!

 /sandeep

 
 Do You Yahoo!?
 Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
 or your free @yahoo.ie address at http://mail.yahoo.ie

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]