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 March 5th, 2007, 05:46 AM
hmvrulz hmvrulz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Bangalorre
Posts: 122 hmvrulz User rank is Sergeant (500 - 2000 Reputation Level)hmvrulz User rank is Sergeant (500 - 2000 Reputation Level)hmvrulz User rank is Sergeant (500 - 2000 Reputation Level)hmvrulz User rank is Sergeant (500 - 2000 Reputation Level)hmvrulz User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 20 h 45 m 51 sec
Reputation Power: 22
Php mysql n wap problem

i have writen a code to get the post from a db of guestbook..

when i can the file it say

Code:
Wrong mime-type, I got text/html, but I want text/vnd.wap.wml.
This error occurs when you request a page that is not a WAP page, or when the webserver isn't set up correctly for hosting WAP sites


but i have used the same wml header previously...

heres my code...

PHP Code:
<? 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\">"?>

<?php 

//open connection
$connection mysql_connect("192.168.2.7""***""****");

// Using the database
mysql_select_db("phpmysql_guestbook",$connection);

// get the post
$get_posts "SELECT id, name, place, phone, email, message, date_format(entry_date, '%b %e %Y at %r') as post_time from guestbook where id = $_GET[id]";

// getting it from db
$get_posts_res mysql_query($get_posts,$connection) or die(mysql_error())

while(
$post_info mysql_fetch_array($get_posts_res)){ 
    
// Build your formatted results here. 
    
$post_id $post_info['id'];
$post_creater stripslashes($post_info['name']);
$post_palce $post_info['place'];
$post_phone $post_info['phone'];
$post_email $post_info['email'];
$post_mess nl2br(stripslashes($post_info['message']));
$post_time $post_info['post_time'];

$display_block .="<big><b>$post_creater :</b></big><br />
<i><small>$post_mess</small></i><br />
<small>
$post_palce<br />
$post_phone<br />
$post_email<br />
$post_time<br /></small>"
;

}
?>

<wml>
<card>
<?php echo $display_block?>

</card>
</wml>


u can see the file at

http://www.gnuer.com/hmv/wap/post.php?id=1

and when i call the file thru web browser it says

Code:
Parse error: syntax error, unexpected T_WHILE in /home/phpmysql/public_html/hmv/wap/post.php on line 20



and the 20th line is

PHP Code:
while($post_info mysql_fetch_array($get_posts_res)){ 
    
// Build your formatted results here. 
__________________

Reply With Quote
  #2  
Old March 5th, 2007, 05:48 AM
Axweildr's Avatar
Axweildr Axweildr is offline
CPAN medic ...
Dev Shed God 13th Plane (11000 - 11499 posts)
 
Join Date: Mar 2003
Location: Location: Location:
Posts: 11,414 Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)Axweildr User rank is General 28th Grade (Above 100000 Reputation Level)  Folding Points: 125303 Folding Title: Super Ultimate Folder - Level 1Folding Points: 125303 Folding Title: Super Ultimate Folder - Level 1Folding Points: 125303 Folding Title: Super Ultimate Folder - Level 1Folding Points: 125303 Folding Title: Super Ultimate Folder - Level 1Folding Points: 125303 Folding Title: Super Ultimate Folder - Level 1Folding Points: 125303 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 4 Months 2 Days 5 h 27 m 31 sec
Reputation Power: 2830
Send a message via Google Talk to Axweildr
Orkut
header("Content-Type: text/vnd.wap.wml\n\n");

headers usually require two newlines after the header type, try that, and see if that sorts it out
__________________
--Ax
without exception, there is no rule ...
The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones


09 F9 11 02
9D 74 E3 5B
D8 41 56 C5
63 56 88 C0
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
-- Jamie Zawinski
Detavil - the devil is in the detail, allegedly, and I use the term advisedly, allegedly ... oh, no, wait I did ...

Reply With Quote
  #3  
Old March 5th, 2007, 06:02 AM
hmvrulz hmvrulz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Bangalorre
Posts: 122 hmvrulz User rank is Sergeant (500 - 2000 Reputation Level)hmvrulz User rank is Sergeant (500 - 2000 Reputation Level)hmvrulz User rank is Sergeant (500 - 2000 Reputation Level)hmvrulz User rank is Sergeant (500 - 2000 Reputation Level)hmvrulz User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 20 h 45 m 51 sec
Reputation Power: 22
Quote:
Originally Posted by Axweildr
header("Content-Type: text/vnd.wap.wml\n\n");

headers usually require two newlines after the header type, try that, and see if that sorts it out


i didnt work... wht should i do

Reply With Quote
  #4  
Old March 5th, 2007, 08:14 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
The error is because you are churning out the page without blocks.
The output code is
xml Code:
Original - xml Code
  1. <?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
  2.  
  3. <wml>
  4. <card>
  5. <big><b>Harsha  :</b></big><br />
  6. <i><small>hh</small></i><br />
  7. <small>
  8. sadkfhk<br />
  9. hhgk<br />
  10. hhg<br />
  11. Feb 28 2007 at 04:30:24 AM<br /></small><a href="/hmv/wap/post.php?id=2"> «Previous</a>
  12.  
  13. </card>
  14. </wml>

You need <p> tags around the actual content.
xml Code:
Original - xml Code
  1. <p><big><b>Harsha  :</b></big><br />
  2. <i><small>hh</small></i><br />
  3. <small>
  4. sadkfhk<br />
  5. hhgk<br />
  6. hhg<br />
  7. Feb 28 2007 at 04:30:24 AM<br /></small><a href="/hmv/wap/post.php?id=2"> «Previous</a></p>
__________________
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.



__________________

Reply With Quote
  #5  
Old March 6th, 2007, 05:42 AM
hmvrulz hmvrulz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Bangalorre
Posts: 122 hmvrulz User rank is Sergeant (500 - 2000 Reputation Level)hmvrulz User rank is Sergeant (500 - 2000 Reputation Level)hmvrulz User rank is Sergeant (500 - 2000 Reputation Level)hmvrulz User rank is Sergeant (500 - 2000 Reputation Level)hmvrulz User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 20 h 45 m 51 sec
Reputation Power: 22
Quote:
Originally Posted by jabba_29
The error is because you are churning out the page without blocks.
The output code is
xml Code:
Original - xml Code
  1. <?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
  2.  
  3. <wml>
  4. <card>
  5. <big><b>Harsha  :</b></big><br />
  6. <i><small>hh</small></i><br />
  7. <small>
  8. sadkfhk<br />
  9. hhgk<br />
  10. hhg<br />
  11. Feb 28 2007 at 04:30:24 AM<br /></small><a href="/hmv/wap/post.php?id=2"> «Previous</a>
  12.  
  13. </card>
  14. </wml>

You need <p> tags around the actual content.
xml Code:
Original - xml Code
  1. <p><big><b>Harsha  :</b></big><br />
  2. <i><small>hh</small></i><br />
  3. <small>
  4. sadkfhk<br />
  5. hhgk<br />
  6. hhg<br />
  7. Feb 28 2007 at 04:30:24 AM<br /></small><a href="/hmv/wap/post.php?id=2"> «Previous</a></p>


hey thanx.... u have seent the code after i have corrected the prob,,..

i had forgotten a ";"

n thanx for reminding the <p>

Reply With Quote
  #6  
Old June 28th, 2007, 05:38 PM
rennevat rennevat is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2007
Posts: 3 rennevat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 28 sec
Reputation Power: 0
I've tried to implement similar code to display a directory for emergency contacts. But I keep receiving an error (502). Due to forum rules, the doc type was modified to remove url.

Any help would be greatly appreciated.

PHP Code:
<?php header("Content-Type: text/vnd.wap.wml");  
echo 
"<?xml version=\"1.0\"?>"
echo 
"<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"" 
" \\">"; 
$state = $_GET['state'];
//open connection 
$connection = mysql_connect("
localhost","my_username","password"); 

// Using the database 
mysql_select_db("
my_db",$connection); 

// get the post 
$get_posts = "
SELECT nameuser_yimuser_intresturl FROM users WHERE mgroup '6' AND user_intrest != '' AND coppa_user 'US' AND user_msnm '$state' ORDER BY user_yim"; 

// getting it from db 
$get_posts_res = mysql_query($get_posts,$connection) or die(mysql_error()); 

while($post_info = mysql_fetch_array($get_posts_res)){  
    // Build your formatted results here.  
     
$post_name = $post_info['name'] . "  "; 
$post_place = "
<br /><br />" . $post_info['user_yim'] . "<br />"; 
$post_phone = $post_info['user_intrest'] . "
<br />"; 
if (!$post_info['url']){
$post_email = "";
}
else
{
$post_email = $post_info['url'] <br />"
;
}
 
$display_block "$post_place<big><b>$post_name</b></big> <small> $post_phone </small><i><small>$post_email</small></i>"


?> 

<wml> 
<card> <p>
<?php echo $display_block?> 
</p>
</card> 
</wml>

Reply With Quote
  #7  
Old June 28th, 2007, 08:14 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