WAP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreWAP 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:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old January 29th, 2006, 08:15 AM
YellowPostit YellowPostit is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Location: UK
Posts: 2 YellowPostit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 23 m 58 sec
Reputation Power: 0
WML, PHP & MySQL - passing a variable?

Hi everyone,

This forum has really helped me get my WAP site up and running, but I'm stuck on one thing...

I have a .wml file with a card which displays the last 10 entries in my weblog. I have the titles set as links, and when someone 'clicks' on them I'd like them to see the whole entry on its own.

However, when the URL has something like ViewEntry?id=10 on the end, it doesn't display any entries. If I remove the '$id' from the MySQL query and put in an ID of an entry, ie 12, it will display the entry with ID 12 just fine.

I've tried and tried to get this working, to no avail. Just wondered if anyone had any pointers as to what I might need to do? The code is below...

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\""
" \"http://www.wapforum.org/DTD/wml_1.1.xml\">";

?>

<wml>

<card id="Home" title="Mediantenne">
<p>
View Mediantenne weblogs
</p>

<p>
<a href="#All">Most recent (all)</a>
</p>

<p>
<a href="#Categories">By Category</a>
</p>

<p>
------------
<br />
<a href="index.wml#Home">Home</a> - Copyright 2006<br />
<a href="index.wml#About">About WAP site</a>
</p>
</card>

    <card id="All" title="Mediantenne Weblogs">
        <p>
        <?php
      
// connect to mysql database
       
include("connect.php");
      
// select information from sports db
        
$query "select id, owner, title, date_format(added, '%e %b') as formatted_date from weblog_entries order by id desc limit 10";
        
$result = @mysql_query($query);
    
        print 
"<b>Recent entries:</b> <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 
"<a href=\"weblogs-ve.wml#ViewEntry?id=$row[id]\">$row[title]</a> <br />$row[formatted_date] - $row[owner]<br /><br />";
            endwhile;
      
// if no information fitting the query is found,
      // display relevant message.
        
else:
            print 
"No current results.";
        endif;

        
?>
        </p>
    </card>
    
    
    <card id="Entry" title="Mediantenne Weblogs">
        <p>
        <?php
      
// connect to mysql database
       
include("connect.php");
      
// select information from sports db
 
$id $_REQUEST['id'];
 
 
$query "select id, owner, title, date_format(added, '%e %b') as formatted_date from weblog_entries where id = '$id'";
        
$result = @mysql_query($query);
    
        print 
"<b>Recent entries:</b> <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 
"<b>$row[title]</b> <br />$row[formatted_date] - $row[owner]<br /><br />";
            endwhile;
      
// if no information fitting the query is found,
      // display relevant message.
        
else:
            print 
"No current results.";
        endif;

        
?>
        </p>
    </card>

</wml>


The same query works fine in PHP, just not on the WAP version.

Many thanks everyone, any ideas are much appreciated!

Jim

Reply With Quote
  #2  
Old January 29th, 2006, 08:53 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,571 jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th 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 3 Weeks 2 Days 9 h 29 m 36 sec
Reputation Power: 1494
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
Welcome to the WAP forums on Dev Shed - enjoy your stay.....

Will hazard a guess at this, but I reckon it is because you are loading the additional card at the same time as the main card. That way, when you are linking to the specific ID card, then there is actually no data as the page doesn't reload.

Have you tried making a seperate page for the individual IDs and using a full link, not anchor, to that page info?
__________________
Cheers,

Jamie


# skiFFie | Home of the 'accessibility module' for Drupal
# Jamie Burns [me] Accessibility Module [drupal]
# guidelines | search | wap resources | not getting help | fold to cure

# Any form of employment is strictly prohibited ......


__________________

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
  #3  
Old January 29th, 2006, 10:28 AM
YellowPostit YellowPostit is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Location: UK
Posts: 2 YellowPostit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 23 m 58 sec
Reputation Power: 0
Quote:
Originally Posted by jabba_29
Welcome to the WAP forums on Dev Shed - enjoy your stay.....

Will hazard a guess at this, but I reckon it is because you are loading the additional card at the same time as the main card. That way, when you are linking to the specific ID card, then there is actually no data as the page doesn't reload.

Have you tried making a seperate page for the individual IDs and using a full link, not anchor, to that page info?

Hi jabba_29,

Thanks for the reply.

I made a mistake when I copied the code in for my first post, but I did what you said and it worked perfectly! The weblogs.wml page points the links to a full URL with the page weblogs-ve.wml. Putting ?id=8 on the end of weblogs-ve.wml shows entry 8.

I've just had a play around with the code and now the new paragraph function works too on the entry (there's no <p> in the database record, the nl2p function puts them in).

Thanks very much again - this site is great!

Jim

Reply With Quote
  #4  
Old January 29th, 2006, 10:42 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,571 jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th 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 3 Weeks 2 Days 9 h 29 m 36 sec
Reputation Power: 1494
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
Glad you got it working. Actually, I think that I have wap pages that used the method that you tried first. But nevermind, I think the seperate page per ID is easier to manage.

Reply With Quote
  #5  
Old April 24th, 2007, 10:51 PM
doggyxr doggyxr is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 doggyxr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 30 sec
Reputation Power: 0
trying to pass more than one variable in WAP

Trying to pass more than one variable in WAP

Hello,

Please I need your help, I am trying to pass more than one variable using php, to be interpreted as wml, but I have an error, so I don't know if the syntax is right the line of code is the following:

<go href="notas1.php?cedula=$(cedula)&codigo=$(codigo)"/>

then I get "invalid entity reference in attribute value".

So please if someone please help me, I really appreciate your support.

Reply With Quote
  #6  
Old April 25th, 2007, 12:44 AM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,571 jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 8th 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 3 Weeks 2 Days 9 h 29 m 36 sec
Reputation Power: 1494
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
Hi and welcome to Dev Shed.

I am not sure whether this is the board that has changed your code but:
The & should be &amp; depending on your character set.

HTH.

Reply With Quote
  #7  
Old March 5th, 2008, 05:27 AM
shauna shauna is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 3 shauna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 17 sec
Reputation Power: 0
Question

Hi guys,

I want to basically take in a username and password and then check to see if its in the mySQL database. The problem is though that I can print the variables yet when I use then in the php query the resultSet is null. If I force the values though the resultSet is not null. If anyone has any ideas on how I can fix this can you let me know ASAP.

Any help would be greatly appreciated.

Heres my code:
PHP Code:
print "<wml>\n";
print 
"<card title=\"home\" id = \"main\">\n";
print 
"<p align = \"center\">\n";
print 
"Username: <input name=\"username\" size = \"10\"/>\n";
print 
"</p>\n";
print 
"<p align = \"center\">\n";
print 
"Password: <input name=\"password\" size = \"10\"/>\n";
print 
"</p>\n";
print 
"<p align = \"center\">\n";
print 
"<a href=\"#results\">Submit</a>\n";
print 
"</p>\n";
print 
"</card>\n";

print 
"<card id=\"results\">\n";
print 
"<p>\n";
print 
"<u>$(username)</u>\n";
print 
"<u>$(password)</u>\n";
print 
"</p>\n";
$link_id mysql_connect("xxxxx, "xxxxx", "xxxx");

if(mysql_select_db("
xxxx", $link_id))
{
    print "
<p>Connected to MySQL database...</p>n";
    
    $query = "
SELECT cust_id FROM customer where username '$(username)'"; 


    $result = mysql_query($query,$link_id); 
    $num_rows = mysql_num_rows($result);
    print "
<p>$num_rows</p>n";
    if($num_rows == 0)
    {
        print "
<p>ERROR</p>n";
    }
    else
    {
        print "
<p>OK</p>n";
    }
}
else
{
  print "
<p>Error in connection....</p>n";
}


print "
</card>n";
print "
</wml>n"; 


Thanks a million in advance,

Shauna

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreWAP Programming > WML, PHP & MySQL - passing a variable?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |