| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Resident Cheese Expert
Join Date: Aug 2006
Location: South Wales
Posts: 424
|
Update SQL not working with PHP
Hi there, I've been working on a PHP/MySQL website for a while. I thought everything was working originally, but now it seems my update has stopped working. It doesn't throw up an error, but the information is just the same as before. The site is here. Not sure how much you can tell from it. The actual code handling the update bits are as follows: editentry1.php PHP Code:
update.php PHP Code:
I have to hand in this bloody assignment on Friday, so any help would be greatly appreciated! Cheers |
|
|
|
|
|
#2 (permalink) |
|
Spare Parts
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,620
|
Okay first thought when my insert and updates stop working has a col that is being addressed in the SQL been removed or renamed in the DB? Secondly you have $table in the query, is $table defined or is it typo? |
|
|
|
#3 (permalink) |
|
Resident Cheese Expert
Join Date: Aug 2006
Location: South Wales
Posts: 424
|
I haven't touched the databse, so it can't be that. Also, the $table is defined in my dbconnect.php include. All of the other pages that involve access to the databse are working fine, which makes me think it must be something isolated on one of the update pages. As I said, it doesn't throw up an error, just acts like its worked, but hasn't! |
|
|
|
#6 (permalink) |
|
Registered
Join Date: Sep 2006
Location: Adelaide, Australia
Posts: 12
|
The UPDATE command (as far as I remember) wont throw an error if it is trying to update a row (as selected by the WHERE clause) when no such row exists in the table. Say for example, trying to update row #45 when there is no row with an ID of 45. Also, I highly recommend you wrap all the field names in "`" to make it easier to distinguish between field names and other data. |
|
|
|
#7 (permalink) |
|
Registered
Join Date: Sep 2006
Location: Adelaide, Australia
Posts: 12
|
Also, just in case. You wrote: Code:
If you have two files then your script may be referring to an old version of the file which may use a different database or table. |
|
![]() |