php - mysql table update gives no result -


i made html form updates fields in table in mysql db after succeful updates should direct me success page otherwise give error msg. indicating error

i use form validation far nothing happens fields in table directs me blank page

here form code :

<html>     <body>     <form action="http://localhost/wordpress/orgupdate.php" method="post" name="myform">         name <input id="name" type="text" name="name" />         telephone <input id="telephone" type="text" name="telephone" />         fax <input id="fax" type="text" name="fax" />         web address <input id="webaddress" type="text" name="webaddress" />         state <input id="state" type="text" name="state" />         address <input id="address" type="text" name="address" />         <input type="submit"  name= "submit" value="update" />     </form>     </body> </html>   <script type="text/javascript">// <![cdata[     /* js validation code here */      function validateform()     {         /* validating name field */         var x=document.forms["myform"]["name"].value;         if (x==null || x=="")         {             alert("name must filled out");             return false;         }         /* validating email field */         var x=document.forms["myform"]["telephone"].value;          if (x==null || x=="")         {             alert("telephone must filled out");             return false;         }     } // ]]> </script> 

and php file :

<?php  //establish connection $con = mysqli_connect("localhost","xx","xxxx","android_app");  //on connection failure, throw error if(!$con) {       die('could not connect: '.mysql_error());  }  //get form elements , store them in variables $name=$_post['name'];  $telephone=$_post['telephone'];  $fax=$_post['fax'];  $webaddress=$_post['webaddress'];  $state=$_post['state'];  $address=$_post['address'];  $query= update  islamic_organisation set (telephone ='$telephone', fax ='$fax', webaddress ='$webaddress', state ='$state', address ='$address'  name  ='$name');  //redirects specified page header("location: http://localhost/wordpress/?page_id=857"); ?> 

any idea ?

$query= "update  islamic_organisation set telephone ='$telephone', fax ='$fax', webaddress ='$webaddress', state ='$state', address ='$address'  name  ='$name'"; $result=mysqli_query($con,$query) or die(mysqli_error()); 

edit 1:

printf("affected rows (update): %d\n", mysqli_affected_rows($con)); 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -