Forum Moderators: coopster

Message Too Old, No Replies

Update won't update

can't see a problem

         

mooger35

5:40 pm on Apr 6, 2006 (gmt 0)

10+ Year Member



<?php require_once('../Connections/somefile.php');?>
<?php
$newsid = $_POST['newsid'];
$date = $_POST['date'];
$news = $_POST['news'];
$title = $_POST['title'];
$fulltext = $_POST['fulltext'];
$expires = $_POST['expires'];
mysql_select_db($database_blah, $blah);
$sqlquery = "UPDATE `news` SET `date` = '$date', `news` = '$news',
`title` = '$title', `fulltext` = '$fulltext', `expires` = '$expires' WHERE `newsid` = $newsid";
$results = mysql_query($sqlquery);
mysql_close();
?>

the $_POST variables are all pulling the correct information but it is not updating the db. Some help?

mooger35

5:54 pm on Apr 6, 2006 (gmt 0)

10+ Year Member



found the problem.

access privledges for the user.

time to move away from the computer. :-)

coopster

5:56 pm on Apr 6, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I would dump the query to the browser first to have a look at the statement. You an also use the mysql_error() [php.net] and it's related function to see what your problem is. One issue I see right off is that you are pushing data directly into your table form user-supplied values without editing any of it first and especially the fact that you are not escaping [php.net] the values! Big security issues here.

mooger35

6:23 pm on Apr 6, 2006 (gmt 0)

10+ Year Member



I normally would but this form is strictly for me. It is located in a password protected admin page and only I update from it.

Probably a good habit to do though, even for my own update forms.

coopster

6:25 pm on Apr 6, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I would agree with you there. Practice makes perfect ;)