1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

my update page is not updating database

Discussion in 'PHP' started by abosirage, Dec 30, 2012.

  1. abosirage

    abosirage Member

    Joined:
    Jul 29, 2010
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    Occupation:
    IT
    Location:
    Tripoli-Libya
    hi every body pls check my fallowing code and help me to correct it to be update my sql
    HTML:
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
    <div align="center">
    <table border="0" width="63%" id="table1">
    <tr>
    <td>
    <?php
    
    if (isset($_POST['update'])) {
    
    $id=$_POST['id'];
    $pro =$_POST['pro'];
    $inf =$_POST['inf'];
    $inf0 =$_POST['inf0'];
    $br =$_POST['br'];
    $bra =$_POST['bra'];
    $br0 =$_POST['br0'];
    $br0a =$_POST['br0a'];
    $br1 =$_POST['br1'];
    $br1a =$_POST['br1a'];
    $br2 =$_POST['br2'];
    $br2a =$_POST['br2a'];
    $inf1  =$_POST['inf1'];
    $inf2  =$_POST['inf2'];
    $inf3  =$_POST['inf3'];
    $inf4  =$_POST['inf4'];
    $inf5  =$_POST['inf5'];
    $inf5a  =$_POST['inf5a'];
    $inf1  =$_POST['inf1'];
    $inf5b  =$_POST['inf5b'];
    
    $db = mysql_connect("localhost", "root","");
    mysql_select_db("cars",$db);
    $sql = "UPDATE owner SET 
    pro ='".mysql_real_escape_string($pro)."',
    inf='".mysql_real_escape_string($inf)."',
    inf0='".mysql_real_escape_string($inf0)."',
    br='".mysql_real_escape_string($br)."',
    bra='".mysql_real_escape_string($bra)."'
    br0='".mysql_real_escape_string($br0)."'
    br0a='".mysql_real_escape_string($br0a)."'
    br1='".mysql_real_escape_string($br1)."'
    br1a='".mysql_real_escape_string($br1a)."'
    br2='".mysql_real_escape_string($br2)."'
    br2a='".mysql_real_escape_string($br2a)."'
    inf1='".mysql_real_escape_string($inf1)."'
    inf2='".mysql_real_escape_string($inf2)."'
    inf3='".mysql_real_escape_string($inf3)."'
    inf4='".mysql_real_escape_string($inf4)."'
    inf5='".mysql_real_escape_string($inf5)."'
    inf5a='".mysql_real_escape_string($inf5a)."'
    inf5b='".mysql_real_escape_string($inf5b)."'
    
     WHERE id=".(int)$id.";";
    $result = mysql_query($sql);
    echo "done";
    
    }
    
    else {
    
    $id=(int)$_GET['id'];
    
    $db = mysql_connect("localhost", "root", "");
    mysql_select_db("cars",$db);
    $result = mysql_query("SELECT * FROM owner WHERE id=$id");
    $row = mysql_fetch_array($result);
      ?>
    <form method="post" action="<?php echo $PHP_SELF?>">
    <input type="hidden" name="id" value="<?php echo $row["id"]?>" />
    <p dir="rtl"><b><span lang="ar-sa">الاسم&nbsp; </span>:</b><span lang="ar-sa">
    </span>
    <input name="pro" value="<?php echo $row["pro"]?>" size="15" tabindex="1" /><br />
    <b><span lang="ar-sa">fullname</span>:</b><span lang="ar-sa"> </span>
    <input name="inf" value="<?php echo $row["inf"]?>" size="90" tabindex="2" /><br />
    <b><span lang="ar-sa">add</span>:</b><span lang="ar-sa"> </span>
    <input name="inf0" value="<?php echo $row["inf0"]?>" size="90" tabindex="3" /><br />
    <b><span lang="ar-sa">e-mail</span>:</b><span lang="ar-sa"> </span>
    <input name="br" value="<?php echo $row["br"]?>" size="15" tabindex="4" /><br />
    <b><span lang="ar-sa">salary</span>:</b><span lang="ar-sa"> </span>
    <input name="bra" value="<?php echo $row["bra"]?>" size="90" tabindex="5" /><br />
    <b><span lang="ar-sa">name</span>:</b><span lang="ar-sa"> </span>
    <input name="br0" value="<?php echo $row["br0"]?>" size="15" tabindex="6" /><br />
    <b><span lang="ar-sa">add1</span>:</b><span lang="ar-sa"> </span>
    <input name="br0a" value="<?php echo $row["br0a"]?>" size="90" tabindex="7" /><br />
    <b><span lang="ar-sa">website</span>:</b><span lang="ar-sa"> </span>
    <input name="br1" value="<?php echo $row["br1"]?>" size="15" tabindex="8" /><br />
    <b><span lang="ar-sa">sal1</span>:</b><span lang="ar-sa"> </span>
    <input name="br1a" value="<?php echo $row["br1a"]?>" size="90" tabindex="9" /><br />
    <b><span lang="ar-sa">اللقب </span>:</b><span lang="ar-sa"> </span>
    <input name="br2" value="<?php echo $row["br2"]?>" size="15" tabindex="10" /><br />
    <b><span lang="ar-sa">add2</span>:</b><span lang="ar-sa"> </span>
    <input name="br2a" value="<?php echo $row["br2a"]?>" size="90" tabindex="11" /><br />
    <b><span lang="ar-sa">name1</span>:</b><span lang="ar-sa"> </span>
    <input name="inf1" value="<?php echo $row["inf1"]?>" size="18" tabindex="12" /><br />
    <b><span lang="ar-sa">name2</span>:</b><span lang="ar-sa"> </span>
    <input name="inf2" value="<?php echo $row["inf2"]?>" size="18" tabindex="13" /><br />
    <b><span lang="ar-sa">add4 </span>:</b><span lang="ar-sa"> </span>
    <input name="inf3" value="<?php echo $row["inf3"]?>" size="18" tabindex="14" /><br />
    <b><span lang="ar-sa">inf </span>:</b><span lang="ar-sa"> </span>
    <input name="inf4" value="<?php echo $row["inf4"]?>" size="18" tabindex="15" /><br />
    <b><span lang="ar-sa">inf1 </span>:</b><span lang="ar-sa"> </span>
    <input name="inf5" value="<?php echo $row["inf5"]?>" size="18" tabindex="16" /><br />
    <b><span lang="ar-sa">inf2 </span>:</b><span lang="ar-sa"> </span>
    <input name="inf5a" value="<?php echo $row["inf5a"]?>" size="18" tabindex="17" /><br />
    <b><span lang="ar-sa">inf3 </span>:</b><span lang="ar-sa"> </span>
    <input name="inf5b" value="<?php echo $row["inf5b"]?>" size="18" tabindex="18" /><br />
    &nbsp;</p>
    <p dir="rtl" align="center">
    <input type="Submit" name="update" value="update" /></p>
    </form> <?php }?>
    </td>
    </table>
    </div>
    <html>
     
    Last edited by a moderator: Dec 30, 2012

Share This Page