For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > December 2004 > Problems with UPDATE









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problems with UPDATE
Ian

2004-12-16, 8:55 pm

Another beginner's question here.

I'm trying to write a record update routine for a database which I've
created and everything seems fine except that the record changes aren't
being written. There are no error messages though and everything seems
to have worked except the record remains the same.

An initial screen asks for a record number (the primary key) which then
retrieves the record in question and displays it in a form on screen
allowing for any fields to be changed. This then calls a php script
which retrieves the values of the fields as follows:

<?php

$rec_no=$_POST['rec_no'];
$piece_no=$_POST['piece_no'];
$folio=$_POST['folio'];
$reg_dist=$_POST['reg_dist'];
$enum_dist=$_POST['enum_dist'];
$house=$_POST['house'];
$address=$_POST['address'];
$forename=$_POST['forename'];
$surname=$_POST['surname'];
$age=$_POST['age'];
$user=$_POST['user'];
$date=$_POST['date'];
$time=$_POST['time'];


I know this bit is working because I got the php script to display the
values before attempting the update.

Then I am calling the UPDATE as follows:

mysql_query(" UPDATE census_recs

SET rec_no='$rec_no', piece_no='$piece_no', folio='$folio',
reg_dist='$reg_dist', enum_dist='$enum_dist', house='$house',
address='$address', forename='$forename', surname='$surname',
age='$age', user='$user', date='$date', time='$time', WHERE
rec_no='$rec_no'");


This generates no errors but also does not update the record.

Can anyone suggest what might be wrong or is there anything I can do to
get the update routine to provide error messages?

Thanks in advance.

Ian


Hilarion

2004-12-17, 3:56 pm

> BTW, what happens if surname is O'Hara?

That depends on magic_quotes_gpc, magic_quotes_sybase etc. (which
I personally dislike).

Hilarion


Alvaro G Vicario

2004-12-21, 3:55 am

*** Ian wrote/escribió (Wed, 15 Dec 2004 02:24:41 GMT):
> Please ignore, now fixed. :-)

[color=darkred]

BTW, what happens if surname is O'Hara?

--
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
--
Hilarion

2004-12-21, 3:55 am

> BTW, what happens if surname is O'Hara?

That depends on magic_quotes_gpc, magic_quotes_sybase etc. (which
I personally dislike).

Hilarion


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com