SunQuest
 
           MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 30th, 2003, 06:12 PM
GandalfTheBrown GandalfTheBrown is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 9 GandalfTheBrown User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
What wrong? Editing a row in mysql

I am having a problem with editing a row in mysql. The script i wrote out seems to show up. It gives me a validation that it has been completed. No parse errors or anything, but it seems that it just doesnt update the new part into teh databse. (I got this method from spoono) lemme add it:
<form action="<? echo $PHP_SELF ?>" method="post">
<?
mysql_pconnect("localhost","******","******"); //enter name and password
mysql_select_db("central"); //select the database
if(!$cmd)
{
$result = mysql_query("select * from data"); //replace news with your table name
while($r=mysql_fetch_array($result))
{
$title=$r["title"];
$name=$r["name"];
$article=$r["article"];
$id=$r["ID"];
?>
?>
<INPUT TYPE="RADIO" NAME="id" VALUE="<?php echo $id;?>"><? echo $id;?> <? echo $title ?><br>
<? } ?>
<input type="submit" name="cmd" value="edit"></form>
<? } ?>
<?
if($cmd=="edit")
{
if (!$submit)
{
$sql = "SELECT * FROM data WHERE id=$id";
//replace news with your table name above
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
?>
<input type=hidden name="id" value="<?php echo $myrow["id"] ?>">
Title:<INPUT TYPE="TEXT" NAME="title" VALUE="<?php echo $myrow["title"] ?>" SIZE=30><br>
Article:<TEXTAREA NAME="article" ROWS=10 COLS=30><? echo $myrow["article"] ?></TEXTAREA><br>
Name:<INPUT TYPE="TEXT" NAME="name" VALUE="<?php echo $myrow["name"] ?>" SIZE=30><br>
<input type="hidden" name="cmd" value="edit">
<input type="Submit" name="submit" value="Post Comment">
</form>
<? } ?>
<?
if($submit)
{
$sql = "UPDATE `data` SET `title`='$title',`article`='$article',`name`='$nam e' WHERE id=$id";
//replace news with your table name above
$result = mysql_query($sql);
echo "Thank you! Information updated.";
}
}
?>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > What wrong? Editing a row in mysql


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway