Jump to content

[SOLVED] Logic Error


elite_prodigy

Recommended Posts

This code calls the information for the form:

<?php
session_start();

if(isset($_SESSION['user']) && isset($_SESSION['id'])){

$conn = //call to mysql_connect('','','');
//call to mysql_select_db('',$conn);

$id = $_SESSION[id];

$get_profile= "SELECT profile FROM `staff` WHERE `id` = '$id';";
$staff_profile= mysql_query($get_profile,$conn);

while($profile_array = mysql_fetch_array($staff_profile)){

$profile = $profile_array['profile'];

$display .= "
<table>

<tr>
<td>
<form method=\"post\" action=\"update_profile.php\">
You are only editing the body of the document. You may use all HTML, and CSS.<br/>
<strong>Do not attempt to hide any ads placed on your page by AdServ.<br />This site will be be deleted without warning!</strong>
<textarea name=\"profile\" rows=\"25\" cols=\"85\" wrap\"virtual\">$profile</textarea><br />
<center><input type=\"submit\" value=\"Update\" /></center>
</form>
</td>
</tr>
<td>
<form method=\"post\" action=\"change_pass.php\">
To change your password, enter it below:<br />
<input type=\"password\" name=\"pass\" />
<input type=\"hidden\" name=\"id\" value=\"$id\" />
<input type=\"submit\" value=\"Change\" />
</form>
</td>
</tr>
</table>
";

}

}

else{

header("location:login.php");

}

?>

 

This updates the profile table:

<?php
session_start();

if(isset($_SESSION['user']) && isset($_SESSION['id'])){

$conn = //call to mysql_connect('','','');
//call to mysql_select_db('',$conn);

$profile = $_POST[profile];
$id = $_POST[id];

$update_profile = "UPDATE `staff` SET `profile` = '$profile' WHERE `id`='$id';";
mysql_query($update_profile,$conn);

header("location:profile.php");
}

else{

header("location:login.php");

}

?>

 

Whenever I attempt to make an update to the profile, nothing is changed.

Link to comment
https://forums.phpfreaks.com/topic/100549-solved-logic-error/
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.