infoitmanoj Posted March 30, 2013 Share Posted March 30, 2013 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title></title> </head> <body> <body> <div class="page-margin-wrapper"> <header> <!--Header Pane Start Here--> <div class="page-wrapper"> <section id="logo"s><a href="index.html"><img src="images/logo.png" alt="" /></a></section> <div class="clear"></div> </div> <!--Header Pane End Here--> </header> <article> <!--Content Area Pane Start Here--> <div class="page-wrapper"> <section id="content_area"> <section id="home_row_one"> <aside class="home_row_one_column"> <form name="form1" method="POST" action="#" onSubmit="return check();"> <?php session_start(); $ebits = ini_get('error_reporting'); error_reporting($ebits ^ E_NOTICE); $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("shg", $con); $result = mysql_query("SELECT * FROM consumer"); session_register("myusername"); session_register("mypassword"); $email=$_POST['myusername']; $password=$_POST['mypassword']; $query="select * from consumer where email='$email' and password='$password'"; $result=mysql_query($query); if(!mysql_num_rows($result)==1) { echo(" <script> alert('INVALID USER / PASSWORD - PRESS (OK) TO LOGIN PAGE'); </script> "); echo ("<script> window.location = 'con_login.html'; </script>"); } ?> <font size="+1"> <b>You Are Succesfully Logged In</b> </font> <?php echo('<b>'); /** * Just add this in your page where you * want the date/time to appear * * For more configuration options look * in the PHP manual at http://uk2.php.net/date */ // Displays in the format Saturday, November 22, 2003 11.38 echo date("l, F d, Y h:i" ,time()); echo('</b>'); ?><br /><br /> <?php echo('<b>'); echo("Total Number of Times Users Visited:="); $count_my_page = ("hitcounter.txt"); $hits = file($count_my_page); $hits[0] ++; $fp = fopen($count_my_page , "w"); fputs($fp , "$hits[0]"); fclose($fp); echo $hits[0]; echo('</b>'); ?> <?php ?> <font size="+1"><a href="login_success.php"> logout </a></font> <script type="text/javascript" language="javascript" > function check() { if(document.form1.n1.value=="") { alert("Please enter name of first name"); document.form1.n1.focus(); return false; } if(!isNaN(document.form1.n1.value)) { alert("Invalid data format.\n\nOnly characters are allowed."); document.form1.n1.focus(); document.form1.n1.value=""; return false; } if(document.form1.n1.value.length<5) { alert("Please enter atleast 5 character"); document.form1.n1.focus(); document.form1.n1.value=""; return false; } if(document.form1.n2.value=="") { alert("Please enter name of last name"); document.form1.n2.focus(); return false; } if(!isNaN(document.form1.n2.value)) { alert("Invalid data format.\n\nOnly characters are allowed."); document.form1.n2.focus(); document.form1.n2.value=""; return false; } if(document.form1.n2.value.length<5) { alert("Please enter atleast 5 character"); document.form1.n2.focus(); document.form1.n2.value=""; return false; } if(document.form1.p1.value=="") { alert("Plese Enter Your Password"); document.form1.p1.focus(); return false; } if(document.form1.p1.value.length<5) { alert("Please enter atleast 5 character"); document.form1.p1.focus(); document.form1.p1.value=""; return false; } if(document.form1.p2.value=="") { alert("Plese Enter Confirm Password"); document.form1.p2.focus(); return false; } if(document.form1.p1.value!=document.form1.p2.value) { alert("Confirm Password does not matched"); document.form1.p1.focus(); return false; } if(document.form1.n3.value=="") { alert("Please enter name of title"); document.form1.n3.focus(); return false; } if(document.form1.n3.value.length<5) { alert("Please enter atleast 5 character"); document.form1.n3.focus(); document.form1.n3.value=""; return false; } if(document.form1.n4.value=="") { alert("Please enter name of organisation"); document.form1.n4.focus(); return false; } if(document.form1.n4.value.length<5) { alert("Please enter atleast 5 character"); document.form1.n4.focus(); document.form1.n4.value=""; return false; } if(document.form1.n5.value=="") { alert("Please mentioned your full address"); document.form1.n5.focus(); return false; } if(document.form1.n5.value.length<10) { alert("Please enter atleast 10 character"); document.form1.n5.focus(); document.form1.n5.value=""; return false; } if(document.form1.n7.value=="") { alert("Please enter name of city"); document.form1.n7.focus(); return false; } if(document.form1.n7.value.length<5) { alert("Please enter atleast 5 character"); document.form1.n7.focus(); document.form1.n7.value=""; return false; } if(document.form1.s1.value=="") { alert("Plese select our state"); document.form1.s1.focus(); return false; } if(document.form1.z1.value=="") { alert("Plese select our zipcode"); document.form1.z1.focus(); return false; } if(isNaN(document.form1.z1.value)) { alert("Invalid data format.\n\nOnly numbers are allowed."); document.form1.z1.focus(); document.form1.z1.value=""; return false; } if(document.form1.z1.value.length<6) { alert("Please enter atleast 6 character"); document.form1.z1.focus(); document.form1.z1.value=""; return false; } if(document.form1.c1.value=="") { alert("Plese select our country"); document.form1.c1.focus(); return false; } if(isNaN(document.form1.fa1.value)) { alert("Invalid data format.\n\nOnly numbers are allowed."); document.form1.fa1.focus(); document.form1.fa1.value=""; return false; } if(document.form1.fa1.value.length<10) { alert("Please enter atleast 10 character"); document.form1.fa1.focus(); document.form1.fa1.value=""; return false; } if(document.form1.e1.value=="") { alert("Plese Enter your Email Address"); document.form1.e1.focus(); return false; } e=document.form1.e1.value; f1=e.indexOf('@'); f2=e.indexOf('@',f1+1); e1=e.indexOf('.'); e2=e.indexOf('.',e1+1); n=e.length; if(!(f1>0 && f2==-1 && e1>0 && e2==-1 && f1!=e1+1 && e1!=f1+1 && f1!=n-1 && e1!=n-1)) { alert("Please Enter valid Email"); document.form1.e1.focus(); return false; } return true; } </script> <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("shg", $con); $result = mysql_query("SELECT * FROM consumer"); $email=$_POST['myusername']; $password=$_POST['mypassword']; $query="select * from consumer where email='$email' and password='$password'"; $result=mysql_query($query); $current_time = date("g:i A"); $current_date = date("l, F jS, Y"); mysql_query("UPDATE login_consumer SET timelogin = '$current_time', datelogin = '$current_date' where email='$email' and password='$password' "); if(mysql_num_rows($result)==1) { $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ session_register("myusername"); session_register("mypassword"); } echo ("<script> alert('welcome'); </script>"); $query="select * from consumer where email='$_POST[myusername]'"; echo "<h2><center>welcome</center></h2>"; echo "<table border='7' cellspacing='10' cellpadding='10'> <tr> <th>title</th> <th>Firstname</th> <th>Lastname</th> <th>title</th> <th>organisation</th> <th>address1</th> <th>address2</th> <th>city</th> <th>state</th> <th>zip</th> <th>country</th> <th>Fax</th> <th>Mail</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['title'] . "</td>"; echo "<td>" . $row['firstname'] . "</td>"; echo "<td>" . $row['lastname'] . "</td>"; echo "<td>" . $row['title1'] . "</td>"; echo "<td>" . $row['organisation'] . "</td>"; echo "<td>" . $row['address1'] . "</td>"; echo "<td>" . $row['address2'] . "</td>"; echo "<td>" . $row['city'] . "</td>"; echo "<td>" . $row['state'] . "</td>"; echo "<td>" . $row['zip'] . "</td>"; echo "<td>" . $row['country'] . "</td>"; echo "<td>" . $row['fax'] . "</td>"; echo "<td>" . $row['email'] . "</td>"; echo "</tr>"; } echo "</table>"; $query="select * from consumer where email='$_POST[myusername]'"; $res = @mysql_query($query); while($row = mysql_fetch_array($res)) { echo "<TABLE BORDER='0' ALIGN='CENTER' WIDTH='95%'>"; echo"<h2>Consumer Registration</h2>"; echo"<h3><b>"; echo"<tr>"; echo"<td>Title</td>"; echo"<td>"; printf("<input type='text' name='t1' value=\"$row[title]\">\n"); echo"</td></tr>"; echo"<tr>"; echo"<td>Firstname</td>"; echo"<td>"; printf("<input type='text' name='n1' value=\"$row[firstname]\">\n"); echo"</td></tr>"; echo"<tr>"; echo"<td>Lastname</td>"; echo"<td>"; printf("<input type='text' name='n2' value=\"$row[lastname]\">\n"); echo"</td></tr>"; echo"<tr>"; echo"<td>Password</td>"; echo"<td>"; printf("<input type='text' name='p1' value=\"$row[password]\">\n"); echo"</td></tr>"; echo"<tr>"; echo"<td>Confirm Password</td>"; echo"<td>"; printf("<input type='text' name='p2' value=\"$row[confirmpassword]\">\n"); echo"</td></tr>"; echo"<tr>"; echo"<td>Title</td>"; echo"<td>"; printf("<input type='text' name='n3' value=\"$row[title1]\">\n"); echo"</td></tr>"; echo"<tr>"; echo"<td>Organisation</td>"; echo"<td>"; printf("<input type='text' name='n4' value=\"$row[organisation]\">\n"); echo"</td></tr>"; echo"<tr>"; echo"<td>Address1</td>"; echo"<td>"; printf("<input type='text' name='n5' value=\"$row[address1]\">\n"); echo"</td></tr>"; echo"<tr>"; echo"<td>Address2</td>"; echo"<td>"; printf("<input type='text' name='n6' value=\"$row[address2]\">\n"); echo"</td></tr>"; echo"<tr>"; echo"<td>City</td>"; echo"<td>"; printf("<input type='text' name='n7' value=\"$row[city]\">\n"); echo"</td></tr>"; echo"<td>State</td>"; echo"<td>"; printf("<input type='text' name='s1' value=\"$row[state]\">\n"); echo"</td></tr>"; echo"<td>Zip</td>"; echo"<td>"; printf("<input type='text' name='z1' value=\"$row[zip]\">\n"); echo"</td></tr>"; echo"<td>Country</td>"; echo"<td>"; printf("<input type='text' name='c1' value=\"$row[country]\">\n"); echo"</td></tr>"; echo"<td>Fax</td>"; echo"<td>"; printf("<input type='text' name='fa1' value=\"$row[fax]\">\n"); echo"</td></tr>"; echo"<td>E-mail</td>"; echo"<td>"; printf("<input type='text' name='e1' value=\"$row\">\n"); echo"</td></tr>"; } } mysql_close($con); ?> <?php //including the database connection file $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("shg", $con); $result = mysql_query("SELECT * FROM consumer where email='$_POST[myusername]'"); if($_POST['update']) { $title= $_POST['t1']; $firstname=$_POST['n1']; $lastname=$_POST['n2']; $password=$_POST['p1']; $confirmpassword=$_POST['p2']; $title1=$_POST['n3']; $organisation=$_POST['n4']; $address1=$_POST['n5']; $address2=$_POST['n6']; $city=$_POST['n7']; $state=$_POST['s1']; $zip=$_POST['z1']; $country=$_POST['c1']; $fax=$_POST['fa1']; $email=$_POST['e1']; $result="update consumer set title='$_POST[t1]',firstname='$_POST[n1]',lastname='$_POST[n2]',password='$_POST[p1]',confirmpassword='$_POST[p2]',title1='$_POST[n3]',organisation='$_POST[n4]',address1='$_POST[n5]',address2='$_POST[n6]',city='$_POST[n7]',state='$_POST[s1]',zip='$_POST[z1]',country='$_POST[c1]',fax='$_POST[fa1]',email='$_POST[e1]' WHERE email='$_POST[myusername]'"; } mysql_close($con); ?> <body> <tr><td></td><td> <input type="submit" name="update" value="update" /></td></tr> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/276310-my-update-php-coding-is-not-working-no-error-no-updating-my-record-pls-mefriends/ Share on other sites More sharing options...
trq Posted March 30, 2013 Share Posted March 30, 2013 Notice that code is normally syntax highlighted here? That's because code needs to be wrapped in code tags. The <> in the editor menu. Now, besides that, you have posted too much none relevant code and no question. Until you fix your post, no one will want to help you. Quote Link to comment https://forums.phpfreaks.com/topic/276310-my-update-php-coding-is-not-working-no-error-no-updating-my-record-pls-mefriends/#findComment-1421895 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.