Mobile Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreMobile Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 13th, 2007, 09:35 PM
shawnhbk shawnhbk is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 302 shawnhbk Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 21 h 53 m 13 sec
Reputation Power: 0
WML php help

Okay when i try i put in the wml by it self it works however when i change the extension to php so i can use code it does not display at all what can i do



PHP Code:
<?
if (isset($_POST['call']) && !empty($_POST['call']) ) 
{
   
$call $_POST['call'];
$conn mysql_connect();

//select the database
$db mysql_select_db(")
or die (mysql_error());

  $query = mysql_query("
SELECT *, song FROM `songsWHERE call '$call' LIMIT 1") ;

$url = $row->song; 

   
   if (!$query)
   {
      echo "
failed";
   }
   else 
   {
      //this is the part you were missing, you need to get the value thats returned. $result is just a result SET
      //not one field or value.. you need to pick through it.
      //
      while ($row = @mysql_fetch_array($query))
      {
    $url  = $row['song'];        
      }
      
      header("
Locationhttp://www.lastpid.com/$url");
   
}
}

echo
'
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>
<card>
<p>
<input name="call" type="text">
 <anchor>
  Go
  <go href="index.php"/>
 </anchor>
</p>

</card> 
</wml>
'

?>

Reply With Quote
  #2  
Old January 13th, 2007, 10:02 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Click here for more information.
 
Join Date: Feb 2002
Location: Finland
Posts: 8,912 jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 4 Weeks 1 Day 13 h 6 m 50 sec
Reputation Power: 1693
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
Scared to post in the wml forums again

What do you mean doesn't work?

Your WML is invalid in places, and do you set the content type anywhere?
If not, the phone may not understand what is coming to it?
Your form is wrong too...

This should get you in the right direction...
php Code:
Original - php Code
  1. <?php
  2. if (isset($_POST['call']) && !empty($_POST['call']) ) {
  3.     $call = $_POST['call']; //~ May wan't to validate this input a bit more
  4.     $conn = mysql_connect();
  5.  
  6.     //~ select the database
  7.     $db    = mysql_select_db('db') or die ( mysql_error() );
  8.     //~ Changed query, only select the fields you need
  9.     $query = mysql_query("SELECT song FROM `songs` WHERE call = '". $call ."' LIMIT 1");
  10.    
  11.     if (mysql_num_rows($query > 0) { //~ there is at least one row return
  12.         $row = mysql_fetch_row($query);
  13.         $url = $row[0];
  14.         header ('Location: http://www.lastpid.com/'. $url);
  15.         exit;
  16.     } else {
  17.         $message = '<p>No rows returned. Try searching again?</p>';
  18.     }
  19. } else { //~ no POSTED values, show form   
  20.         $message = '<p>
  21.         <input name="call" type="text" />
  22.         <anchor>Go <go method="post" href="index.php" /></anchor>
  23.         <postfield name="call" value="$(call)" />
  24.         </p>';       
  25.  
  26. header ('Content-Type: text/vnd.wap.wml; charset=ISO-8859-1');
  27. echo '<?xml version="1.0"?>
  28. <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
  29. "http://www.wapforum.org/DTD/wml_1.1.xml">
  30. <wml>
  31. <card>'. $message .'</card>
  32. </wml>
  33. ';
  34. }


Your WML won't execute if
Comments on this post
codergeek42 agrees: It won't execute if.... ?
__________________
Cheers,

Jamie

# mdb4u | mobile movie database] | Please help to test and promote
# skiFFie | Home of the 'accessibility module' for Drupal
# Jamie Burns [me] Accessibility Module [drupal]
# guidelines | search | wap resources | not getting help | fold to cure

__________________

Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.



__________________

Last edited by jabba_29 : January 13th, 2007 at 10:44 PM.

Reply With Quote
  #3  
Old January 13th, 2007, 10:16 PM
codergeek42's Avatar
codergeek42 codergeek42 is offline
[Insert clever comment here.]
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Jul 2003
Location: Anaheim, CA (USA)
Posts: 6,438 codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)codergeek42 User rank is General 3rd Grade (Above 100000 Reputation Level)  Folding Points: 39542 Folding Title: Starter FolderFolding Points: 39542 Folding Title: Starter Folder
Time spent in forums: 1 Month 1 Week 6 Days 11 h 38 m 3 sec
Reputation Power: 1158
Send a message via ICQ to codergeek42 Send a message via AIM to codergeek42 Send a message via Yahoo to codergeek42 Send a message via Google Talk to codergeek42
Moved from PHP Development to WAP Programming.
__________________
~~ Peter ~~
( My Blog: It's exactly like normal nerdiness, but completely different. ) :: ( Supporter of the EFF & FSF ) :: ( I'm a GNU/Linux addict and Free Software Advocate. ) :: ( How to Ask Questions the Smart Way ) :: ( The Fedora Project, sponsored by Red Hat ) :: ( GNOME: The Free Software Desktop Project ) :: ( GnuPG Public Key )

Reply With Quote
  #4  
Old January 13th, 2007, 11:35 PM
shawnhbk shawnhbk is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 302 shawnhbk Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 21 h 53 m 13 sec
Reputation Power: 0
okay men is the problem with line 31?

Reply With Quote
  #5  
Old January 13th, 2007, 11:54 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Click here for more information.
 
Join Date: Feb 2002
Location: Finland
Posts: 8,912 jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 4 Weeks 1 Day 13 h 6 m 50 sec
Reputation Power: 1693
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
It is cause your code is outputting invalid WML.
Errors in XML often cause the page to "break".

Can you view the source in opera of firefox?
Validate your code - there is a list here..

Reply With Quote
  #6  
Old January 13th, 2007, 11:58 PM
shawnhbk shawnhbk is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 302 shawnhbk Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 21 h 53 m 13 sec
Reputation Power: 0
no the php is screwed up
Parse error: syntax error, unexpected '{' in /home/shawnhbk/public_html/lastpid/wap/index.php on line 31

Reply With Quote
  #7  
Old January 14th, 2007, 12:05 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Click here for more information.
 
Join Date: Feb 2002
Location: Finland
Posts: 8,912 jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 4 Weeks 1 Day 13 h 6 m 50 sec
Reputation Power: 1693
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
Help yourself - please be more descriptive.
Line 31 on your code? The code I posted?
The error is self-explanatory. You may have just missed a semi-colon ;
on a line or so before...

Reply With Quote
  #8  
Old January 14th, 2007, 09:15 PM
shawnhbk shawnhbk is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 302 shawnhbk Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 21 h 53 m 13 sec
Reputation Power: 0
Quote:
Originally Posted by jabba_29
Help yourself - please be more descriptive.
Line 31 on your code? The code I posted?
The error is self-explanatory. You may have just missed a semi-colon ;
on a line or so before...

i fixed however i still cannot get the php to display propely in a wml file

Reply With Quote
  #9  
Old January 14th, 2007, 11:52 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Click here for more information.
 
Join Date: Feb 2002
Location: Finland
Posts: 8,912 jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 4 Weeks 1 Day 13 h 6 m 50 sec
Reputation Power: 1693
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
Can you post the code you are using now?
And I link to the source code if you have one...

Reply With Quote