View Single Post
Old 08-23-2007, 01:59 PM  
dirtysouth
Confirmed User
 
Join Date: Jul 2003
Location: Mobtown
Posts: 2,613
PHP Gurus HELP!@#!!

Got a page where users can edit their account details ie: useredit.php

That page posts to "do-useredit.php

User must be logged in. Here's some code:

useredit.php

PHP Code:
<?php
require_once('../mysql_connect.php');
session_start();

if(isset(
$_SESSION['id']))
{
    
$mn trim($_SESSION['id']);
    require_once(
'../mysql_connect.php');
    
$query "SELECT * FROM shoppingmembers WHERE member_name = '$mn'";
    
$result mysql_query($query);
    
$row mysql_fetch_array($resultMYSQL_ASSOC);
}

echo
'


<form name="form1" method="post" action="do-useredit.php">
<input type="text" name="bill_fname" value="' 
$row['bill_fname'] . '" style="font-size:9px"><br />
<input type="submit" name="submit" value="Update" />'
;

?>
Here's the second page:

do-useredit.php

PHP Code:
<?php
require_once('../mysql_connect.php');
session_start();



$_GET['mn'];


if(isset(
$_SESSION['id']))
{
    
$mn trim($_SESSION['id']);
    require_once(
'../mysql_connect.php');
    
$query "SELECT * FROM shoppingmembers WHERE member_name = '$mn'";
    
$result mysql_query($query);
    
$row mysql_fetch_array($resultMYSQL_ASSOC);



}



mysql_query("UPDATE shoppingmembers SET bill_fname = '$bill_fname' WHERE member_name = 'admin'")or die(mysql_error());



echo 
"Record Updated";
print 
$mn;



?>
Problem: When I have session_start in the top of do-useredit.php, it doesn't UPDATE. When I comment it out it works fine. The trouble is, I can't pass the member_name into the query, hence in the above I simply force it to UPDATE WHERE member_name = 'admin' (me). Any ideas? I have paypal funds avail. TIA!
__________________
no sig
dirtysouth is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote