I’ve scrolled through all the posts and can’t see a similar question, so hopefully this isn’t a repeat.
I have a MySQL DB system set up which works well but now we need to tweak it a bit. It works in conjunction with a Mal’s E-comm shopping cart so that people can donate to sponsor trophies for a dog show.
Currently, the UPDATE record command just turns the “Show_Hide” field from “Y” to “N” so that a second person can’t try to pay for the same trophy.
Now, however, the powers that be want the trophy to stay visible but without the shopping cart fields visible. I know I can just removed the instruction to change Y to N but I’m stumped on how to tell it to NOT display two specific fields.
This is my current bit of code:
$sql="UPDATE trophies
SET Show_Hide = 'N', dedication = '$dedication', donor ='$name
WHERE ID = $id
";
It turns off the Show_Hide field and also adds the dedication the purchaser wants as well as their name.
I can’t figure out how to get it to NOT display the input type=‘checkbox’. I’m thinking that it probably isn’t done in the UPDATE instruction for the DB itself but I’m drawing a complete blank on how to do it!
Could someone kindly point me in the right direction on how to do this? Thanks!
The first line is one which has not been paid yet. The second line HAS been paid for and is displaying the dedication. I need to get rid of the checkbox at left and the blank “dedication” box at right but have drawn a blank on how to do that.
The idea is you don’t put everthing within the condition, only the bits that you don’t want to always show.
You will need to alter the query to SELECT the Show_Hide column and remove it from the WHERE clause.
Thanks DarthGuido. I would certainly do that except I can’t figure out just what you’re saying. Sorry - my brain is not what it was 40 years ago! It doesn’t help that it is EXTREMELY rigid/black-and-white.
Let me give it a shot: You’re saying I should NOT change the Show_hide in the UPDATE part (which I did already figure out) but rather do it somehow in the “if … while … echo” part? Is that correct?
Sorry SamA74 - my black-and-white brain is being really pig-headed today. By “condition” do you mean the “if … while … echo” part? I’ve tried to figure out just what you’re saying but am drawing a complete blank.
Oh! That makes sense … assuming I can figure out the correct coding. Thanks! I’ll give my brain a rest for a while and give that a try later. Thanks so much to you, SamA74 and to DarthGuido for replying so quickly!! Much appreciated.
As you can see from the above, I DID get it to remove the check box and text entry box for the trophies which have been paid for but for the LIFE of me I cannot figure out why it will not display the Donor name!
As far as I can see the “donor” and “dedication” fields are identical - what on earth am I missing? I think there must be something I’m missing about the donor field because if I change the - if ($row[“dedication”] == “”) - part to “donor” instead of “dedication” (which I’d prefer) then the whole thing doesn’t work - it displays ALL the checkboxes and box to enter the dedication.