SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    no display for some form element

    Code:
    <?php
    include 'config.php';
    include 'opendb.php';
    
    
    session_start();
    
    
    echo "loginname=".$_SESSION['loginname'];
    $login=$_SESSION['loginname'];
    echo "<br/>";
    echo "loginvariable=".$login;
    
     $result = mysql_query("SELECT username,password FROM person") or die('Query failed: ' . mysql_error());
     
     
     while($row = mysql_fetch_array($result,MYSQL_ASSOC)){
       echo "username=".$row["username"];
       echo "password=".$row["password"];
        echo "ic=".$row["ic"];
       
        
       echo "row username=".$row["username"];
       echo "row password=".$row["password"];
       echo "row country=".$row["country"];
       echo "row ic=".$row["ic"];
    
    /*
    echo "<table>";
    echo "<tr>";
    echo "<td>";
    echo "username=";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='username' value='".$row["username"]."' />";
    echo "</td>";
    echo "</tr>";
    
    echo "<tr>";
    echo "<td>";
    echo "Country=";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='country' value='".$row["country"]."' />";
    echo "</td>";
    echo "</tr>";
    
    
    echo "<tr>";
    echo "<td>";
    echo "IC=";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='ic' value='".$row["IC"]."' />";
    echo "</td>";
    echo "</tr>";
    
    echo "<tr>";
    echo "<td>";
    echo "fullname=";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='fullname' value='".$row["Fullname"]."' />";
    echo "</td>";
    echo "</tr>";
    
    echo "<tr>";
    echo "<td>";
    echo "gender=";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='gender' value='".$row["Gender"]."' />";
    echo "</td>";
    echo "</tr>";
    
    
    echo "<tr>";
    echo "<td>";
    echo "DOB=";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='dob' value='".$row["dob"]."' />";
    echo "</td>";
    echo "</tr>";
    
    echo "<tr>";
    echo "<td>";
    echo "address=";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='address' value='".$row["address"]."' />";
    echo "</td>";
    echo "</tr>";
    
    echo "<tr>";
    echo "<td>";
    echo "postcode=";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='postcode' value='".$row["postcode"]."' />";
    echo "</td>";
    echo "</tr>";
    
    echo "<tr>";
    echo "<td>";
    echo "city=";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='city' value='".$row["city"]."' />";
    echo "</td>";
    echo "</tr>";
    
    echo "<tr>";
    echo "<td>";
    echo "state=";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='state' value='".$row["state"]."' />";
    echo "</td>";
    echo "</tr>";
    
    
    echo "<tr>";
    echo "<td>";
    echo "phonenumber=";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='phonenumber' value='".$row["phonenumber"]."' />";
    echo "</td>";
    echo "</tr>";
    
    
    echo "<tr>";
    echo "<td>";
    echo "hpnumber=";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='hpnumber' value='".$row["hpnumber"]."' />";
    echo "</td>";
    echo "</tr>";
    
    
    echo "<tr>";
    echo "<td>";
    echo "accname=";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='accname' value='".$row["accname"]."' />";
    echo "</td>";
    echo "</tr>";
    
    echo "<tr>";
    echo "<td>";
    echo "accnumber=";
    echo "</td>";
    echo "<td>";
    echo "<input type='text' name='accnumber' value='".$row["accnumber"]."' />";
    echo "</td>";
    echo "</tr>";
    
    
    */
    
    }//end while
    
    
    
    ?>
    this two element echo "row country=".$row["country"];
    echo "row ic=".$row["ic"]; showing empty value but my database there is not empty, why? thanks.

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its easy because your SELECT statement did not select any column called the ic. You have to include it next to your username/password or run another query for it.
    My Network
    Deluxe Web Directory
    FontCubes Free Fonts


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •