Alright, this is my first bit of php work I've ever done and here is what I have so far:
A news database is set up
You can add to the database
You can view the database
Now I am trying to get an editing system up. I'm trying not to tie these all into one file, as I am going to have different levels of editing for different users, but right now I just want to get the dang thing working. Here is what I have so far
edit.php
<html>
<head><title> Saving News </title></head>
<body bgcolor="#FFFFFF">
<?
// get newsid from link
$i = $_GET['newsid'];
/* declare some relevant variables */
$DBhost = "localhost";
$DBuser = "*******";
$DBpass = "*******";
$DBName = "pspnetw_pspdata";
$table = "psp_news";
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable toconnect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$sqlquery = "SELECT * FROM psp_news";
$result = mysql_query($sqlquery);
$newsid = mysql_result($result,$i,"newsid");
$newstitle = mysql_result($result,$i,"newstitle");
$summary = mysql_result($result,$i,"summary");
$fullarticle = mysql_result($result,$i,"fullarticle");
Print "<FORM METHOD=POST ACTION='editsubmit.php3'>
<TABLE>
<TR><TD>
<INPUT TYPE='text' NAME='newstitle' VALUE='$newstitle'><br><br>
<TEXTAREA NAME='summary' ROWS=8 COLS=100>$summary</text><br>
<TEXTAREA NAME='fullarticle' ROWS=14 COLS=100>$fullarticle</text><br>
<p><INPUT TYPE='submit' value='Submit News'></td></tr>
</TABLE></FORM></body></html>";
?>
And editsubmit.php3
<html>
<head><title> Saving News </title></head>
<body bgcolor="#FFFFFF">
<?
/* declare some relevant variables */
$DBhost = "localhost";
$DBuser = "*******";
$DBpass = "*******";
$DBName = "pspnetw_pspdata";
$table = "psp_news";
$summary=$_POST['summary'];
$newstitle=$_POST['newstitle'];
$fullarticle=$_POST['fullarticle'];
$newsid=$_POST['newsid'];
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable toconnect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$sql = "UPDATE psp_news SET newstitle='$newstitle', summary='$summary',fullarticle='$fullarticle' WHERE newsid='$newsid'";
$result = mysql_query($sql);
mysql_close();
print "<HTML><TITLE> PHP and MySQL </TITLE><BODY
BGCOLOR=\"#FFFFFF\"><center><table border=\"0\"
width=\"500\"><tr><td>";
print "<p>news updated!</td></tr></table>
</center></BODY></HTML>";
?>
Any suggestions as to what I am doing wrong? Right now it will pull up the article for editing, and let me hit submit... then it says news updated! and looks like it is working alright... but it doesn't actually update it.