I'm trying to mess around with script to edit a single row in a table, but for some reason, it wont update.
Anyone help out? p-p-p-please
edit page
PHP Code:
<?php
mysql_connect("localhost","username","password") or die("Error: ".mysqlerror());
mysql_select_db("db_name");
$sql = "select * from `ring` where ID = 'user'";
$query = mysql_query($sql);
while ($row = mysql_fetch_array($query)){
$id = $row['ID'];
$value = $row['value'];
$text = $row['text'];
$image = $row['image'];
}
mysql_free_result($query);
?>
<html>
<head>
<title>Edit User Info</title>
</head>
<body>
<form action="updateinfo.php" method="post">
ID:<br/>
<input type="text" value="<?php echo $id;?>" name="id" disabled/>
<br/>
Value:<br/>
<input type="text" value="<?php echo $value;?>" name="value"/>
<br/>
Text:<br/>
<input type="text" value="<?php echo $text;?>" name="text"/>
<br/>
Image:<br/>
<input type="text" value="<?php echo $image;?>" name="image"/>
</br>
<input type="submit" value="submit changes"/>
</form>
</body>
</html>
and here is the update info page
PHP Code:
<?php
mysql_connect("localhost","username","password") or die("Error: ".mysqlerror());
mysql_select_db("db_name");
$id = $row['ID'];
$value = $row['value'];
$text = $row['text'];
$image = $row['image'];
$sql = "UPDATE `ring` SET `value` = '$value',`text` = '$text',`image` = '$image' WHERE `ring`.`ID` = '$id' LIMIT 1";
mysql_query($sql) or die ("Error: ".mysql_error());
echo "Database updated. <a href='editinfo.php'>Return to edit info</a>";
?>
the single user that I am trying to edit is named "user" in the table
i'll have some paypal sent later this week if someone wants a few bucks, or let me know how i can help you out
