View Single Post
Old 09-15-2010, 12:48 PM  
96ukssob
So Fucking Banananananas
 
96ukssob's Avatar
 
Industry Role:
Join Date: Mar 2003
Location: If I was in your ass you'd know it
Posts: 12,991
any PHP guys around? have a question

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
__________________
Email: Clicky on Me
96ukssob is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote