[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

09/27/2009 at 03:13PM PDT, ID: 24765588 | Points: 500
[x]
Attachment Details

Problems updating database

Asked by MsKazza in PHP and Databases

Tags: MySQL, PHP

Hi
Was hoping someone could help me, i'm totally stumpped.  I've been developing a website on my pc using xampp, on my pc it works fine.  The problem is the user Profile update page, when i upload it, everything updates no problem except for the avatar, if i put the server config file on my localhost and run the update.php it updates the live internet site, but the live update.php won't update properly.  It just leaves the avatar field blank.
Below is the update.php page, any help much appreciated.
Thanks,
MsKazza
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
<?php
 
include "../config.php";
 
$username = $_COOKIE['loggedin'];
if (!isset($_COOKIE['loggedin'])) die("You are not logged in, <a href=../login.html>click here</a> to login.");
 
mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); 
 
mysql_select_db($database)
or die ("Could not select database because ".mysql_error());
 
mysql_query("UPDATE $table SET fname = '".$_POST['fname']."'
WHERE username = '$username'");
 
mysql_query("UPDATE $table SET lname = '".$_POST['lname']."'
WHERE username = '$username'");
 
mysql_query("UPDATE $table SET email = '".$_POST['email']."'
WHERE username = '$username'");
 
mysql_query("UPDATE $table SET password = '".$_POST['newpass']."'
WHERE password = '".$_POST['oldpass']."'");
 
mysql_query("UPDATE $table SET website = '".$_POST['website']."'
WHERE username = '$username'");
 
mysql_query("UPDATE $table SET avatar = '".$_POST['avatar']."'
WHERE username = '$username'");
 
echo "Changes made to $username's profile.<br /> <a href='profile.php'>Click here</a> to return to your profile.<br /> Please note if you entered in your old password incorrectly the new password will not change.<br />";
 
?>
[+][-]09/27/09 03:30 PM, ID: 25435771

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/27/09 05:06 PM, ID: 25436045

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/28/09 03:53 AM, ID: 25681741

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/28/09 04:25 AM, ID: 25681987

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/28/09 04:35 AM, ID: 25682068

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/28/09 04:54 AM, ID: 25682196

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-91 - Hierarchy / EE_QW_3_20080625