bradgrafelman wrote:What does it do?
Its just to edit a row in MySQL. Here's the first page:
include ('inc/config.php');
$query = ('SELECT ID,name,start_date,headline FROM cmsnews2 WHERE CURDATE() >= start_date ORDER BY ID DESC LIMIT 0,5');
if(!isset($cmd))
{
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
echo $row['name'];
echo '<a href="pages/news/viewNews.php?id='.$row['ID'].'">';
echo $row['headline'];
echo '</a>';
echo $row['start_date'];
echo '<a href="pages/news/editNews.php?cmd=edit&id='.$row['ID'].'">Edit</a>';
echo '<p>';
}
}
A user clicks 'edit' and gets taken to the page I posted.
bradgrafelman wrote:Is error reporting turned on and set to E_ALL ? If so, do you get any error messages?
Yes and I get "Undefined index: submit in H:\xampplite\htdocs\pages\news\editNews.php on line 39"
bradgrafelman wrote:Is there really any need to escape out of PHP just for some blank lines? Might make the PHP code shorter and easier to read if you cut down on some of this whitespace and unnecessary closing/reopening of the PHP tags. No errors or anything here (other than this habit possibly giving you "headers already sent" errors in the future), just a tip/suggestion/etc.
If I just have } without escaping out of PHP I get "Parse error: syntax error, unexpected $end in H:\xampplite\htdocs\pages\news\editNews.php on line 70"
bradgrafelman wrote:Eh.. guess I can be rather long-winded. Sorry 'bout that! :o
Not at all. You're very helpful thanks 🙂
What code would you use to edit a row in a MySQL table?