...

View Full Version : Updating problem?



SMGames
07-19-2007, 09:13 AM
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:

<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
$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:


$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
$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.

_Aerospace_Eng_
07-19-2007, 09:37 AM
And you are able to see the other member pages? Echo out the query to see if its what you are wanting.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum