Update not working ... please help
Posted on
16th Feb 2014 07:03 pm by
admin
Hi,
I am trying to update a row using an edit form by passing id of the row .. but it is not working .. can anybody find what went wrong ........
Code: [Select]echo '<a href="addedit.php?edit&id='.$row['id'].'" title="Edit This Member"';
Did you know?Explore Trending and Topic pages for more stories like this.
echo '><img src="images/edit.png"></a>
if(isset($_GET['edit']))
{
$sql="select * from news where id=$_REQUEST[id]";
$row=mysql_fetch_row(mysql_query($sql));
$action="editnews";
$news=$row[2];
$subject=$row[1];
$button='Update news';
include 'newsForm.php';
exit();
}
if (isset($_POST['action']) and $_POST['action'] =='Update news')
{
$id=$_REQUEST['id'];
$sql='update NEWS SET news="'.$_POST['news'].'",subject ="'.$_POST['subject'].'",added=curdate() where news.id= "$id"';
if(mysql_query($sql))
echo "Updated";
} newsForm.php
Code: [Select]<form action=?<?php echo $action; ?> method="post">
<p><label>News Subject :</label><input name="subject" type="text" size="60" value="<?php echo $subject; ?>"></p>
<p><label>News :</label><textarea rows="20" cols="50" name="news" ><?php echo $news; ?></textarea></p>
<input type="hidden" name="id" value="<?php echo $id; ?>"/>
<p><input type="submit" name="action" value="<?php echo $button; ?>"></p>
</form>Pleas somebody let me know what went wrong ..Thanks in advance
No comments posted yet
Your Answer:
Login to answer
279
22
Other forums
natcasesort works on one server but not on another
Hi
I have a problem that I was hoping that someone can help me with.
I'm trying to use
generating all possible random letters
hi'
how can i randomize the letters a,b,c,d,e all possible ways, and i want to print the res
How can I get my program to read a larger array ??
Hi:
I have this program that reads from an array to do calculations. The array are just t
Weird MySQL error, why am I recieving this?
PHP Code:
<?php require "global_settings.php"; ?>
<titl
preg_replace question
Hello!!
I hope someone can help me with preg_replace.
I load two tables from an extern
Regular expression tips or resources
Hello! I'm having some issues implementing the appropriate regex patter to eliminate unwanted charac
Which PHP-Editor do you think is the best?
Hi everyone,
Myself Brian Anderson. For the last 2 years i have been working a
Form Help
Here is the form:
Line number On/Off | Expand/Contract<? include("../include/sess
order by date not ID number help php
I am trying to orginize the following code to order by date not id number.
any help would be grea
change text color with a jQuery code
Hihow can I change the text in a asp:TextBox to a different color when I start typing using jQuery?I