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 February 12th, 2007, 10:16 AM
zack17 zack17 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 16 zack17 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 1 m 19 sec
Reputation Power: 0
Php and wap integration help

i have a php&wml script that is giving me a problem. now the problem comes in when i want to query a table from a mysql database.

the query only works when i query the whole table or when query a specific name.the moment the problems start are when i place a verable into the query that throws the thing off.

can anyone give me an example of a script that has worked which alows an imput and then findes the input with the quey and displays the content related

any help would be much welcomed
thanks

Reply With Quote
  #2  
Old February 12th, 2007, 10:24 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,914 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 45 m 8 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
I don't have any specific code for you off hand but
try the WAP Resources -
in particular the Developer's Home pages.

The debug.
When you are processing your form, try to print_r your results to see what is actually getting passed.

Also, if you need further help, please post your relevant code.

Hope that helps, good luck and Welcome to DS...
__________________
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 : February 12th, 2007 at 10:30 AM.

Reply With Quote
  #3  
Old February 12th, 2007, 10:43 AM
zack17 zack17 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 16 zack17 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 1 m 19 sec
Reputation Power: 0
i am new to wml but is wml case sensitive

Reply With Quote
  #4  
Old February 12th, 2007, 11:01 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,914 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 45 m 8 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
Yes, because it is a derivative of XML.

Reply With Quote
  #5  
Old February 12th, 2007, 11:08 AM
zack17 zack17 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 16 zack17 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 1 m 19 sec
Reputation Power: 0
i tested the variable with the print_r and it returns the value i entered but the program is not working.

here is the script


php Code:
Original - php Code
  1. <?php
  2.  
  3.  header("Content-type: text/vnd.wap.wml")
  4.  
  5.   print "<?xml version=\"1.0\"?>\n"
  6.   print "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"" 
  7.   . " \"http://www.dubbyou.com/DTD/wml_1.1.xml\">\n";
  8.  
  9.     print'
  10. <wml>
  11.      
  12.    
  13.    <card id="main" title="test" newcontext="false">
  14.       <do type="accept" label="login">
  15.       
  16.       
  17.         <go method="POST"  href="http://10.2.1.100/wap/test5.php">
  18.         <postfield name="name" value="$(name)"/>
  19.         <postfield name="password" value="$password"/>
  20.          </go>
  21.                
  22.       </do>
  23.           <p>Name</p>
  24.           <p>
  25.          <fieldset>Name:
  26.             <input type="text" name="name" size="5"
  27.       emptyok="false"/>
  28.          </fieldset>
  29.       </p>
  30.    
  31.    
  32.    
  33.             <p>Password</p>
  34.       <p>
  35.          <fieldset>password
  36.              <input type="password" name="password" size="5"
  37.       emptyok="false"/>
  38.          </fieldset>
  39.       </p>';
  40.    
  41.    
  42.    
  43.    
  44.    
  45. $user="****";
  46. $pass="****";
  47. $db="****";
  48. $link= mysql_connect("localhost", $user, $pass );
  49. if (! $link)
  50. die ("cannot connect to mysql");
  51. or die ("cannot select database");
  52.  
  53.  
  54.   $query ="SELECT * FROM user WHERE user_name='$(name)' ";
  55.   $result = mysql_query($query,$link)
  56.   or die("Query failed:$query");
  57.   $num=mysql_numrows($result);
  58.  
  59. $results= print_r($name);
  60. print "<p>$query</p>";
  61. print "<p>results: $num</p>";
  62. print "<p>name resul: $results</p>";
  63. print '<p>Name $name</p>';
  64.  
  65. print'   </card>
  66.     </wml>  ';
  67.  
  68.   ?>

Last edited by jabba_29 : February 12th, 2007 at 07:05 PM. Reason: removed passwords ;)

Reply With Quote
  #6  
Old February 12th, 2007, 07:11 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,914 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 45 m 8 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
Try querying the database using PHP variables, not WML variables:
$_POST['name'] etc...

php Code:
Original - php Code
  1. <?php
  2. function quote_smart($value)
  3. {
  4.     // Stripslashes
  5.     if ( get_magic_quotes_gpc() )
  6.     {
  7.         $value = stripslashes( $value );
  8.     }
  9.     // Quote if not a number or a numeric string
  10.     if ( !is_numeric( $value ) )
  11.     {
  12.         $value = "'" . mysql_real_escape_string($value) . "'";
  13.     }
  14.     return $value;
  15. }
  16.  
  17. // NOTE: ALWAYS CHECK YOUR USER INPUT; EVEN ON A PHONE
  18. $query ="SELECT * FROM user WHERE user_name=". quote_smart($_POST['name']);

Reply With Quote
  #7  
Old February 13th, 2007, 09:22 AM
zack17 zack17 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 16 zack17 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 1 m 19 sec
Reputation Power: 0
okay sorry for the long wait as i had school but i tryed your code in my script but the function produces a wml error saying that it is not wml content.

can you tel me how u get a variable out from a wml <postfield> and into a php variable pls

Reply With Quote
  #8  
Old February 13th, 2007, 09:40 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,914 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 45 m 8 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 show exactly what you have got so far,
and how you process the info?

Reply With Quote