Solved

Update profile not updating for certain whole number values.

Posted on 2009-07-12
2
140 Views
Last Modified: 2012-05-07
This is a continuation on from question I.D. 24546173

Basically I have a page within my website which allows members of the site to update their profile. The profiles are drawn from a MySQL database. There was a field (Teaching Experience)
which was not updating correctly, and on the update page, was not displaying the informaion which was in the database.

However thanks to Almer and Ray on this site (points still to be awarded as question I.D. 24546173 not closed yet) I'm able to get the page working so that it correctly displays the value in the database on the update page for some of the values - but not all, hence why I'm asking another new question.

Basically, the page updates correctly for values 0.0, 0.2, 0.5, 0.7, 1.5, 2.5 but not for whole values 1.0, 2.0, 3.0 , 4.0, 5.0, 6.0, 7.0 etc.

I have no idea why.

I have re-opened this question as the last one was no longer getting a response and I am hoping to resolve this issue before the working week begins.

Thanks


<?php     echo "<pre>"; print_r( $row_rsupdate['teachingexperience']); echo "</pre>";    ?>
 
								<select name="teachingexperience">
                                  <option value="0" <?php if ($row_rsupdate['teachingexperience'] == 0) {echo "selected=\"selected\"";} ?>>No Experience</option>
                                  <option value="0.2" <?php if (!(strcmp(0.2, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>Just a couple of months</option>
                                  <option value="0.5" <?php if (!(strcmp(0.5, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>About 6 months</option>
                                  <option value="0.7" <?php if (!(strcmp(0.7, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>About 9 months</option>
                                  <option value="1.0" <?php if (!(strcmp(1, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>1 year</option>
                                  <option value="1.5" <?php if (!(strcmp(1.5, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>1 and half years</option>
                                  <option value="2.0" <?php if (!(strcmp(2.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>2 years</option>
                                  <option value="2.5" <?php if (!(strcmp(2.5, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>2 and half years</option>
                                   <option value="3.0" <?php if (!(strcmp(3.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>3 years</option>
                                  <option value="4.0" <?php if (!(strcmp(4.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>4 years </option>
                                  <option value="5.0" <?php if (!(strcmp(5.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>5 years</option>
                                  <option value="6.0" <?php if (!(strcmp(6.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>6 years</option>
                                  <option value="7.0" <?php if (!(strcmp(7.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>7 years</option>
                                  <option value="8.0" <?php if (!(strcmp(8.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>8 years</option>
                                  <option value="9.0" <?php if (!(strcmp(9.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>9 years</option>
                                  <option value="10.0" <?php if (!(strcmp(10.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>10 years</option>
                                  <option value="11.0" <?php if (!(strcmp(11.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>11 years</option>
                                  <option value="12.0" <?php if (!(strcmp(12.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>12 years</option>
                                  <option value="13.0" <?php if (!(strcmp(13.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>13 years</option>
                                  <option value="14.0" <?php if (!(strcmp(14.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>14 years</option>
                                  <option value="15.0" <?php if (!(strcmp(15.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>15 years</option>
                                  <option value="16.0" <?php if (!(strcmp(16.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>16 years</option>
                                  <option value="17.0" <?php if (!(strcmp(17.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>17 years</option>
                                  <option value="18.0" <?php if (!(strcmp(18.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>18 years</option>
                                  <option value="19.0" <?php if (!(strcmp(19.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>19 years</option>
                                  <option value="20.0" <?php if (!(strcmp(20.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>20 years</option>
                                  <option value="21.0" <?php if (!(strcmp(21.0, $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>more than 20 !</option>
                                </select>

Open in new window

0
Comment
Question by:ayounis
2 Comments
 
LVL 50

Accepted Solution

by:
Steve Bink earned 125 total points
ID: 24849464
One possibility is that your call to strcmp() is passing a number value.  PHP will simplify from 21.0 to 21, for example.  Try specifying the strcmp() parameters as strings:


<option value="21.0" <?php if (!(strcmp("21.0", $row_rsupdate['teachingexperience']))) {echo "selected=\"selected\"";} ?>>more than 20 !</option>

Open in new window

0
 

Author Comment

by:ayounis
ID: 24919706
Yep - that worked.

Thanks alot routinet and sorry for the delay, in responding.

Many thanks.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
First name pregmatch 11 39
how to get top 5 assets which having more tickets raised using sql 5 48
Mysql Crashing Intermittently 16 103
MySql hide the stored procedures 2 48
More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question