tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hello to everyone reading this.
Im a beginner of PHP and MySQL, and i'm having a little difficulty updating one of my databases.
Basically, i have a single page consisting of a table, where i echo some information from the database. This echoing occurs without fail.
I also have x3 drop down menus, one for a Comment, another for Progress and the last for confirming whether the job is Complete or not.
When i make my selections and press submit, it looks as though it updates the database, but it does not. Although the clear button works.
My initial thoughts were, are you able to echo information and update information in a single form? I'm not sure, although i don't see why not, and thats why i have made this such attempt.
If anyone can help, i'd be glad to hear.
Heres my code:
---------------------------
Notice how the query for the insert is no longer stored in the $result variable but actually performed on demand. Try this. If it doesnt work then I blame my inability to focus on your ugly code! j/k
Hello,
thankyou for your reply. I had a look at what you said and tried out your method, BUT it still didn't work.
I understand what you meant in your reply, so i renamed each $result variable, in relation to each query i'v set, to a much easier representation by placing increasing numbers in front of each variable name. eg, $result1, $result2, etc.
Although i have clarified this, my database still does not update.
If anyone can please help me, id be very glad to hear.
I just realized, in your SELECT query you used the table name 'FAULT' while in the INSERT query you used 'Fault'. MySQL is case sensitive with table names!! Take this along with my previous advice and you should be gold maybe...
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hi Jough,
thanks for your replies, very much appreciated. Thank you, but unfortunatley the changes still didn't do anything.
Umm, as for throwing errors, i don't get any at all which is even more weird.
Iv made the changes you suggested. I also had changed the name of FAULT to fault before you had posted your reply. Picked up on that, but i didn't know that it was case sensitive. I'll keep that in mind.
Here's the code as it stands. I press submit, and it takes me to my history page, where the result should go after the update, but it doesn't.
Also, maybe you can clarify something for me....... in my code, is my query for updating always being confused with my query for looking for ongoing calls. The query is looking for ongoing calls from my fault table, and i want to update these calls to complete, or leave them as ongoing and just add an updated comment so someone can track its progress.
It just seems that the update query isn't doing anything at all. I had problems with my {} brackets, in terms of if statements, i dont get them to be quite honest as i have never really used them before.
Here's the code:
--------------------
From what I have gotten from your code your 'fault' table has nine fields:
FaultID
AdminID
StaffID
Location
Problem_Desc
Date
Technician_Comment
Progress
Complete
Is there any more fields in this table? What is the primary key of this table?
Is 'Fault_All_My_Completed_Calls.php' the name of this file? If not then where are you getting the Post variables to place in the INSERT query?
You wanted me to clarify something for you and mentioned the query for updating?? Is this page supposed to update the table row or insert a new one?? I see no UPDATE query right now.
What is the contents of the 'conn1.inc.php' file? Do you have access rights to use the INSERT query?
Sorry for so many questions but the answer to every one will help me find what is wrong with your entire script. The problem could be ANYTHING...