Solved

Update profile not updating for certain whole number values.

Posted on 2009-07-12
2
143 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 51

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

705 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