updating profile information(mysql database)

i am working on a project
in which i need to create a option for for editing a user’s profile…
but getting error now …

update.php (script for present the saved data) :

<?php include('lock.php'); $host="localhost"; // Host name $username="root"; // Mysql username $password="*****"; // Mysql password $db_name="dailynotes"; // Database name $tbl_name="userinformation2"; // Table name $user=$login_session; // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // get value of id that sent from address bar $id=$_GET['id']; // Retrieve data from database $sql="SELECT id,firstname,lastname,username,emailid,password FROM $tbl_name where id='$id' "; $result=mysql_query($sql); $rows=mysql_fetch_array($result); ?>
  Update data in mysql
       
  Firstname Lastname username Email Password Update
 
   
<? // close connection mysql_close(); ?>

second file which performs the update in mysql database

update_ac.php :

<?php include('lock.php'); $firstname=$_POST['firstname']; $lastname=$_POST['lastname']; $username=$_POST['username']; $email=$_POST['emailid']; $password=$_POST['password']; $id=$_GET['id']; $connection=mysql_connect("localhost","root","****") or die("unable to connect with database"); $db=mysql_select_db("dailynotes",$connection) or die("unable to find such database"); if(isset($_REQUEST['submit'])) { $query="UPDATE userinformation2 SET firstname='$firstname',lastname='$lastname',username='$username',emailid='$email',password='$password' where id='$id' "; $result=mysql_query($query) or die("query failed:".mysql_error()); if($result) { echo"success"; } } ?>

check the code …
help plz…

We probably can help you. But, what error are you getting and what line is the code stopping at?

Please place code inside of the PHP tags above next time. It is easier for us to copy the code to our editors that way.

Let us know the error you are getting. Thanks…

Sponsor our Newsletter | Privacy Policy | Terms of Service