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"';
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
279
22
Other php-forum
my code does not work.
I have a code problem.
Quote"<a href=index.php?gogo=ureticidetay&'?l={$le
XML Grouping
I'm using xml_parse_into_struct to get all my elements, but now I need to group them. For example, h
2 decima places & How to reload my page
Hello There,
How do i put full-stop (.) after second figure from behind? ie if i have 123456
JSON SORT WITH PHP
I have two products that I want to sort by say "Id:17, value: xxx" using php
The page w
Web Host List
Here is a list of web hosts that offer PHP and MySQL. It is no where near a full list, but it is mos
Creating an invoice
Using fpdf I am trying to create an invoice to send to clients. The products are sold in pricing tie
Running a cron job through PHP/Apache?!
Hello all,
I have a PHP script which makes a cron file from user input. When i try to run the cro
limitations on array_unique()
Does any one know what/how imitations are applied to array_unique? I have an issue where no matter h
Can't find a decent web analytics!!!
I've downloaded and installed Piwik. It's location detection based on IP addresses is fairly inaccur
IF STATEMENT HELP
Hi
i have created a calendar from a table:
Code: Calendar: October 2009
<table w