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 December 18th, 2007, 10:16 PM
oriental_expres oriental_expres is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 1 oriental_expres User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 38 m 48 sec
Reputation Power: 0
WML - WML form wont insert record into mysql via php.

Hi there everyone, im kinda having trouble getting my application to store data, my problem is that it seems to connect to mysql but then it says " ("Could not add data to the table"); "

Im using this wml deck
Code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" 
   "http://www.wapforum.org/DTD/wml_1.1.xml"> 

<wml>

<card id="aged" title="Aged Charites">
	<p align="center">Select charity to donate </p>

	   <p>
	     <select>
    	     <option title="Pilgrim Homes"         onpick="#pilgrimhomes">Pilgrim Homes</option>
     	     <option title="Guild Care"            onpick="#guildcare">Guild Care</option>
             <option title="Carers UK"             onpick="#carersuk">Carers UK</option>
             <br/><br/>
           </p>

              <p>
              <a href="menu.wml#main">Main menu</a>
              </p>

</card>


<card id="pilgrimhomes" title="Pilgrim Homes">
       <p>We have been looking after needy, elderly Christians since 1807.<br/></p>

             <p align="center"><b>Form<b/></p>

                  <p>
		   	Name:  <input name="name" size="15"/>
			Adddress:   <input name="address" size="15"/>
			Credit card no:  <input name="ccn" size="15"/>
			Expiry date mm/yy:  <input name="expirydate" size="15"/>
			Security code:  <input name="securitycode" size="15"/>
			Amount to donate:  <input name="amount" size="15"/>
			
			<anchor>
                          <go method="post" href="agedpillgrimhomes.php">
          			<postfield name="name" value="$(name)"/>
          			<postfield name="address" value="$(address)"/>
          			<postfield name="ccn" value="$(ccn)"/>
          			<postfield name="expirydate" value="$(expirydate)"/>
				<postfield name="securitycode" value="$(securitycode)"/>
				<postfield name="amount" value="$(amount)"/>
        		</go>
        			Submit
      			</anchor>

		  </p>

<p>
<a href="menu.wml#main">Main menu</a>
    
</p>

</wml>



and this is my php code to store the data but its not working

Code:
<?php header('Content-type: text/vnd.wap.wml'); ?>
<?php echo '<?xml version="1.0"?'.'>'; ?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">

<?php
#this script stores form entry data as before but will validate for empty fields
# and check for a duplicate record of the book, in either case an error message
# will be displayed in the client
 
import_request_variables("P", "mypost_");

/* Get the posted book form's values from the request object*/

$name = $mypost_name;
$address = $mypost_address;
$ccn = $mypost_ccn;
$expirydate = $mypost_expirydate;
$securitycode = $mypost_securitycode;
$amount = $mypost_amount;

if (empty($name) || empty($address) || empty($ccn) || empty($expirydate) || empty($securitycode) || empty($amount)) 
{  
	echo "Please go back and fill in all the fields"; 
}  
else 
{ 
	//db connection - Note how the next few lines have moved away from the book data storage SQL
	
	$connection = @mysql_pconnect("localhost", "admin", "admin") or die("cannot make connection");  
	/* Set up database and table names */	
	$db_name = "wml";  
	$table_name = "agedpillgrimhomes"; 
		
		
	//Open db connection
	$db = @mysql_select_db($db_name, $connection) or die(mysql_error());	
	
	$query = "SELECT name FROM $table_name WHERE name ='$name'"; 
	$result = mysql_query($query, $connection); 
	$numrows = mysql_num_rows($result); 
	
	if ($numrows == "0") 
	{
		//No match - book is unique
		
		//Create SQL string
		$insert = "INSERT INTO $table_name (name,address,ccn,expirydate,securitycode,amount) VALUES      ('$name','$address','$ccn','$expirydate','$securitycode','$amount'"; 
		
       mysql_query($insert) or die ("Could not add data to the table");
		
		echo "Your donation has been successfully recieved";

	} 
	else 
	{ 
		//The book has been entered on a previous occasion
		echo "Your donation was not accepted this time"; 
		exit();  
	} 
	
}
?>


ive created a database via mysql but does not work cause the record wont insert. Ive made sure the phone simulator is in good order but still no luck. Can anyone help please

Thanks

Reply With Quote
  #2  
Old December 19th, 2007, 06:13 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.
Try print_r the $_POST variables at every stage to see that they exist.

Also, try echoing out your $insert query.
You could also use mysql_error() and error_no for more 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 February 26th, 2008, 01:16 AM
shruthi_cd shruthi_cd is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 21 shruthi_cd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 45 m 21 sec
Reputation Power: 0
i have problems with inserting my records into database using servlets
Comments on this post
lnxgeek disagrees!

Reply With Quote
  #4  
Old February 26th, 2008, 01:25 AM
lnxgeek lnxgeek is offline
I AM A GOLDEN GOD
Dev Shed God (5000 - 5499 posts)
 
Join Date: Apr 2003
Location: cannot find symbol: method showLocation()
Posts: 5,278 lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 21 h 17 m 36 sec
Reputation Power: 564
shruthi_cd> Don't hijack someone else's old thread with a separate question. Please find the appropriate forum to post in, create a lucid, relevant post and wait patiently for a response.
Comments on this post
jabba_29 agrees!
__________________
BookMooch.com : Give books away. Get books you want.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreWAP Programming > WML - WML form wont insert record into mysql via php.


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway