Hi guys,
  
              I  have a problem regarding updating a record. The code im using 
is  attached to the mail. Plz look in to it and let me know the solution.
  
            Actually there  is no problem in getting the values from the form, 
i think the only  problem is with the update sql command. I checked it but i 
couldnt find  any problem. I would be glad if you can solve the problem of mine.
  
  The field values in the table of addressbook are 
  
   tenantid,fname,mname,lname,phone,email,streetaddress,apt_no,city,state
  
  Plz solve my problem
  cya
  
                
---------------------------------
Yahoo! Mail
Bring photos to life! New PhotoMail  makes sharing a breeze. 
  ----------

<?php
$search = $_REQUEST["search"];
$link= mysql_connect( 'localhost', 'root', 'santhosh' ) ;
  //    echo( "Connected to database.<br>\n" );
     
   // select the database
   mysql_select_db( 'mini');
    //  echo( "Selected the database.<br>" );
if(isset($_POST["submit"]))
{
     $a=$_REQUEST["tenantid"];
         $b=$_REQUEST["fname"];
         $c=$_REQUEST["mname"];
     $d=$_REQUEST["lname"];
         $e=$_REQUEST["phone"];
     $f=$_REQUEST["email"];
$g=$_REQUEST["stadd"];
$h=$_REQUEST["apt"];
$i=$_REQUEST["city"];
$j=$_REQUEST["state"]; 
$link= mysql_connect( 'localhost', 'root', 'santhosh' ) ;
  //    echo( "Connected to database.<br>\n" );
     
   // select the database
   mysql_select_db( 'mini'); 
$query="update addressbook set 
fname='$b',mname='$c',lname='$d',phone='$e',email='$f',streetaddress='$g',apt_no='$h',city='$i',state='$j'
  where tenantid='$search'";   
print("id is 
$a");print("$b");print("$c");print("$d");print("$e");print("$f");print("$g");print("$h");print("$i");print("$j");
//$dbresult=mysql_query($query,$link);
if(mysql_query($query))
{
 echo("Record Updated Successfully");
// Header("Location: add1.php");
// exit;
 }
 else
 echo("<CENTER>Updation Failed</center>");
 
}
else
{
   // create the table
      $query = " SELECT * from addressbook where 
addressbook.tenantid='$search'";
          $dbresult=mysql_query($query,$link);
//$i=0;
//$r=mysql_numrows($dbresult);
//while($i<$r)
//{
//mysql_data_seek($dbresult,$i);
$row=mysql_fetch_row($dbresult);


//while($row<mysql_fetch_row($dbresult)){
//
//
$a = $row[0];
$b = $row[1];$c = $row[2];$d = $row[3];$e = $row[4];$f = $row[5];$g = 
$row[6];$h = $row[7];$i = $row[8];$j = $row[9];
//print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tenant ID# : $row[0] <br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name : $row[1] $row[2] $row[3] <br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Phone : $row[4] <br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Email : $row[5] <br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Street Name : $row[6] <br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Apt # : $row[7] <br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;City : $row[8] <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
State : $row[9]<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rent : $row[11] <br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utilities : $row[12] <br> 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total : 
($row[11]+$row[12])<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" ); 
//$i++;
} 
?>
<html>
<head>
<title>Address Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<!--$update_query= "UPDATE addressbook SET tenantid='$a' 
fname='$b',mname='$c',lname='$d',phone='$e',email='$f',stadd='$g',apt='$h',city='$i',state='$j'
 where tenantid='$search'";-->
<table  cellpadding="0" cellspacing="0" border="0" align="center" width=90% 
height=10% bgcolor="#660033">
<tr>
<td align="center">
<font color="#FFFFFF"><b><h2>Address Form</h2></b></font>
</td>
</tr>
</table>
<br>
<table  cellpadding="0" cellspacing="0" border="0"  width=40% height=3%>
<tr>
<td align="left">
<font style="font-size: 15pt; color:#660033     
">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>Enter
 Personal Information</u></font></td>
</tr>
</table>
<br>
<table align="center" height="500" width="700">
<tr>
 <td align="left" valign="top">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Tenant ID# :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text"  
value="<?php echo $a; ?>" name="tenantid" > <br><br>
First Nmae :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" 
value="<?php echo $b; ?>" name="fname" size="35"> <br><br>
Middle Name :&nbsp;&nbsp;&nbsp;<input type="text" value="<?php echo $c; ?>" 
name="mname" size="5" >  <br><br>
Last Name :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" 
value="<?php echo $d; ?>" name="lname" size="20" > <br><br>
<u><i>Enter Contact Details</i></u><br><br>
Phone/Cell :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" 
value="<?php echo $e; ?>" name="phone" size="20">  <br><br>
Email : 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input
 type="text" value="<?php echo $f; ?>" name="email" size="25" >   <br><br>
Street Address :  <input type="text" value="<?php echo $g; ?>" name="stadd" 
size="50" >  <br><br>
Apt # 
:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input
 type="text" value="<?php echo $h; ?>" name="apt" size="15" >  <br><br>
City 
:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <input type="text" value="<?php echo $i; ?>" name="city" size="25">  <br><br>
State 
:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input
 type="text" value="<?php echo $j; ?>" name="state" size="25"> <br>
<center><input type="submit" name="submit" value="submit"></center><br>
</form>
</td>
</tr>
</table>
<center><a href="add1.php">Back</a></center>
</body>
</html>

[Non-text portions of this message have been removed]



The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to