Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

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 Codewalkers Forums Sponsor:
  #1  
Old December 22nd, 2002, 05:08 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
Simple problem with PHP and MySQL not populating corectly some of my forms...

Here is the deal, I want to be able to update the record through the form. So I want to populate the form first with the original data. Then the user sees the original content, modifies the entry in the form, and hits the update button, which in turn sends the update query to MySQL server....
Here is how it works...

$sql = mysql_query ("SELECT InvoiceNumber, FName, LName, Address, City, State, Zip, Tel, Email,
FROM customerdata,
WHERE InvoiceNumber LIKE '$snumber'");

$row = mysql_fetch_array($sql);
print "<form action="updatequery.php" method="post">";
do
{
print "<p>";
print "<font face="Century Gothic" size="2">Service Order#: </font>";
print "<input type="text" name="service" size=8 value=";
print $row['InvoiceNumber'];
print ">";
print "<font face="Century Gothic" size="2"> First name: </font>";
print "<input type="text" name="fname" size=15 value=";
print $row['FName'];
print ">";
print "<font face="Century Gothic" size="2"> Last name: </font>";
print "<input type="text" name="lname" size=15 value=";
print $row['LName'];
print "><br />";
print "<p>";
print "<font face="Century Gothic" size="2">Address: </font>";
print "<input type="text" name="address" size=14 value=";
print $row['Address'];
print " >";
print "<font face="Century Gothic" size="2"> City: </font>";
print "<input type="text" name="city" size=11 value=";
print $row["City"];
print ">";
print "<font face="Century Gothic" size="2"> State: </font>";
print "<input type="text" name="state" size=2 value=";
print $row["State"];
print ">";
print "<font face="Century Gothic" size="2"> Zip: </font>";
print "<input type="text" name="zip" size=4 value=";
print $row["Zip"];
print ">";
print "<font face="Century Gothic" size="2"> Tel#: </font>";
print "<input type="text" name="tel" size=9 value=";
print $row["Tel"];
print "><br />";
print "<p>";
print "<font face="Century Gothic" size="2">E-mail: </font>";
print "<input type="text" name="email" size=17 value=";
print print $row["Email"];
print ">";
print " <input type="submit" value="Update Record" /></form>";
} while ($row = mysql_fetch_array($sql));

OK, let me state that this code works, but not in 100%. The fields address and city are populated only partially.
Ie if the field "adress" has a value of "12345 Trigger St", only "12345" will show up in the form. This same applies to the field "city". The name of the city is "Ann Arbor", but only "Ann" will pop up in the form...?
Help,
What I am doing wrong?
The records in the database are setup to use varchar type. Maybe that is the problem?

Reply With Quote
  #2  
Old December 22nd, 2002, 05:51 AM
hermawan's Avatar
hermawan hermawan is offline
Superman is not dead
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Jakarta, Indonesia
Posts: 553 hermawan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 44 m 37 sec
Reputation Power: 3
Send a message via ICQ to hermawan Send a message via AIM to hermawan Send a message via Yahoo to hermawan Send a message via Google Talk to hermawan Send a message via Skype to hermawan
RE: Simple problem with PHP and MySQL not populating corectly some of my forms...

You must change all of your input, replace this one:
php Code:
Original - php Code
  1.  
  2. print "<input type="text" name="address" size=14 value=";
  3. print $row['Address'];
  4. print " >";

With this
php Code:
Original - php Code
  1.  
  2. print "<input type="text" name="address" size=14 value="";
  3. print $row['Address'];
  4. print "">";


Take a good look, and you'll see the different.

Reply With Quote
  #3  
Old December 22nd, 2002, 05:21 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
RE: Simple problem with PHP and MySQL not populating corectly some of my forms...

O'right!
Thanks a lot!!!!
Now I got it...

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Simple problem with PHP and MySQL not populating corectly some of my forms...


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!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

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




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 11 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek