PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
// Enter info into the Database.
$sql = "UPDATE teachers_news SET date = '$date', news = '$news' WHERE id = '$id'";
$result = mysql_query($sql) or die(mysql_error());
if(!$result){
echo ("<center><font class="txt"There has been an error inserting the data. Please contact the webmaster.</font></center>");
} else {
echo ("<center><font class="txt">Sucessfully Updated</font></center><br><br>");
echo ("<center><font class="txt"><a href="../index.php?pages=teachers_news">BACK</a></font></center><br>");
}
You never execute your query, therefor, it is never FALSE.
The problem was your checking for $_GET variables while your form method is POST. I would always use the post method because $_GET does not have a very long char limit.
Omg, I thought it was $_GET data from the posted form
Thanks $_POST sorted it ..
Can anyone suggest a good php/mysql book that gives tutorials on the general basis of what people would use in web design .. ie add/edit/delete, functions, sql seacrh queries etc etc ..
I try to learn of the net .. but so many tutorials have different styles to acheive the same thing .. I think learning would be easyer to follow one style of coding then venture to better ways after that ..
Another question .. when I edit a record .. the selected date is the server "todays" date .. not the date that is in the database for the record being edited .. what needs to change to have it select the date in the database within the drop down menus?
Cheers
Last edited by Jim_Bo on Wed Feb 09, 2005 5:54 pm, edited 1 time in total.
Jim_Bo wrote:
Another question .. when I edit a record .. the selected date is the server "todays" date .. not the date that is in the database for the record being edited .. what needs to change to have it select the date in the database within the drop down menus?