Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2007
    Location
    UK
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Updating problem?

    Hi on my site i have a page which allows users to insert html, a little like there own webpage, however it only updates for me and no other users.
    This is the page where the users edit there page:
    PHP Code:
    <textarea cols="50" rows="27" name="space">
    <?php
    $username
    ="******";
    $password="******";
    $database="******";

    mysql_connect('******',$username,$password);
    @
    mysql_select_db($database) or die("Unable to select database");

    $loginname $_SESSION['loginname'];

    $result mysql_query("SELECT * FROM user_space WHERE loginname='$loginname'") or die(mysql_error());  

    $row mysql_fetch_array$result );

    echo 
    $row['space'];
    ?>
    </textarea>
    This is the code which updates the page:
    PHP Code:
    <?php
    $username
    ="******";
    $password="******";
    $database="******";

    mysql_connect('******',$username,$password);
    @
    mysql_select_db($database) or die("Unable to select database");

    $loginname=$_SESSION['loginname']; 
    $space=$_POST['space'];

    $result mysql_query("UPDATE user_space SET space='$space' WHERE loginname='$loginname'"
    or die(
    mysql_error());  

    ?>
    If its needed heres the create table code:
    PHP Code:
    $query="CREATE TABLE user_space( 

    id          INT           NOT NULL    AUTO_INCREMENT, 
    loginname   VARCHAR(20)   NOT NULL, 
    space       TEXT                        NOT NULL, 

    PRIMARY KEY(id) )"

    And the code which people view each others page:

    PHP Code:
    <?php
    $username
    ="*****";
    $password="*****";
    $database="*****";

    mysql_connect('******',$username,$password);
    @
    mysql_select_db($database) or die("Unable to select database");

    $loginname $_GET['member'];
    $result mysql_query("SELECT * FROM user_space WHERE loginname='$loginname'") or die(mysql_error());  

    $row mysql_fetch_array$result );

    echo 
    $row['space'];
    ?>
    If anyone has any ideas please help, thanks.
    http://www.smgames.staticfire.co.uk Under construction, Currently hiring mods and admins anyone interested pm me.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    And you are able to see the other member pages? Echo out the query to see if its what you are wanting.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •