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
question about stripslashes and real_escape_string
im cleaning up an old app that I wrote fixing some of the vulernabilities from attacks.
I hav
Need Reporting Advice
My SQL server doesn't support MS SQL reporting services that comes with SQL Enterprise or Express. T
Adding Different Numbers From MySQL
Basically I have a mysql database with a couple prices as the following:
9.99
9.99
9.99
Custom Container in module pool program
Hello everyone,
I have created a custom control in my module pool screen. Now I want to s
do while...woes
I'm sure this is childsplay but it is stumping me, everytime i try what I think would make this work
cPanel API
Hi Guys,
Need a little guidance. I'm trying to get my script to communicate with cPanel (or W
gettext translates ALWAYS?
I'm using gettext with the new version of XAMPP (5.3.0) on Windows Seven RTM (build 7600)
gettext
Socket problem
Hello,
Earlier I posted about my problem with my socket script. It took up to 100% CPU usage.
DBCA Templates
Hi all,
I'm working on creating a template for DBCA, but can't find any documentation on the
Posting Serialized Data Not Working
I am trying to send an object from one PHP file to another using POST. I serialize the object and th