Forum Moderators: coopster
OK I have a database which contains certain records that I wish to change (UPDATE) through a webpage. I have created two seperate .php files:
'MILTON_EDIT.php'
and
"MILTON_EDITIT.php"
What is happening at the moment is that the table is shown on the site. The user can click on the first column (The date) and be taken to the records for that date, with the current details for that day filled in. when they edit some values and click on 'SUBMIT' on the first form (milton_edit.php) instead of being sent to 'milton_edittit.php the page just refreshes giving the error "Sorry, no information" from 'milton_edit.php'
I am at a loss as to what is happening, again any pointers appreciated!
[edited by: jatar_k at 4:56 pm (utc) on July 18, 2003]
[edit reason] see charter regarding code dumps [/edit]
but I will put the relevant bits here and hope I havent left any important bits out. I really need this sorted out, am stuck and cnt move forward till I get this sorted...
$sql="UPDATE milton SET date='$date', counter='$counter',cash='$cash',cards='$cards',cheques='$cheques'
,paid_out='$paid_out',total='$total',total_scripts='$total_scripts'
,total_purchases='$total_purchases',comments='$comments' WHERE ID='$ID'";if(!mysql_query($sql,$connection)) {
echo "Error cannot Amend record<BR>";
echo "Go Back";
exit;
}else{
#amend OK inform user
echo "Table Updated<BR>";
echo "Record amended";
}
this bit of code doesnt seem to work for me...the vales dont get changed when I alter them...anyone see anything wrong with this?
[edited by: jatar_k at 8:35 pm (utc) on July 18, 2003]
[edit reason] split line for sidescroll [/edit]
another litlle trick is to use
mysql_query($sql) or die (mysql_error [ca.php.net]);
that will give you the actual error from mysql instead of your own generated error message.
UPDATE `milton` SET `date`='2003', `counter`='2000', `cash`='1500', `cards`='250', `cheques`='250', `paid_out`='200', `total`='1800', `total_scripts`='200', `total_purchases`='12', `comments`='' WHERE `ID`=''
I noticed right at the end it says WHERE `ID`=''
though I told it to do WHERE `ID`='$ID'";
whats happening here?
[edited by: jatar_k at 9:38 pm (utc) on July 18, 2003]
[edit reason] edit for sidescroll [/edit]