Jump to content

[SOLVED] Edit Profile


bmdsherman

Recommended Posts

I am creating a website in which users can login to and have access to certain applications, I am trying to allow users to edit their "profile" that is stored in a mysql database under the following headers, id, fname, lname (last name), email, cellphone, homephone, otherphone, address, status (0=inactive 1=active), pword.

 

Here is the script to view your own profile:

<?php
$p = $_GET['p'];


$dbhost = '**********;
$dbuser = '**********';
$dbpass = '**********';
$dbname = '*********';
?>
<?php

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($dbname);
?>

<?php
session_start();
$email = $_SESSION['myusername'];
//echo "$email";
//echo $_SESSION['email'];
$sql = "SELECT * FROM email WHERE email='$email'";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)) {


echo'
<table border="0" cellspacing="10" cols="20" frame="true" rules="none" align="center" width="600">
  <tbody>
    <tr>
      <td>First Name</td>
      <td>'.$row['fname'].'</td>
    </tr>
    <tr>
      <td>Last Name</td>
      <td>'.$row['lname'].'</td>
    </tr>
    <tr>
      <td>Email Address</td>
      <td>'.$row['email'].'</td>
    </tr>
    <tr>
      <td>Cell Phone Number</td>
      <td>'.$row['cellphone'].'</td>
    </tr>
    <tr>
      <td>Home Phone Number</td>
      <td>'.$row['homephone'].'</td>
    </tr>
    <tr>
      <td>Other Phone Number</td>
      <td>'.$row['otherphone'].'</td>
    </tr>
    <tr>
      <td>Home Address</td>
      <td>'.$row['address'].'</td>
    </tr>
  </tbody>
</table>

';}
?>
</table>
</body>
</html>
<br><br>
<?php include "footer.php"?>

 

So far that is working perfectly, but what if I want to allow users to edit their profile?

What would I have to do?

Link to comment
https://forums.phpfreaks.com/topic/170497-solved-edit-profile/
Share on other sites

first: there is missing a ' after dbhost = '****

Oops! my bad, in the actual script the ' is there, but when I changed it to *'s I accidentally deleted it.

 

second: You should make a form in which people can write their new email, address, ...

and a submit button to get the php working

That's a good idea, but I'm trying to somehow create a forum with all of the values pr-entered and users can edit and resubmit it, but I don't know how to edit a mysql row.

Link to comment
https://forums.phpfreaks.com/topic/170497-solved-edit-profile/#findComment-899488
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.