Ten Years of Service
Posts: 26
Threads: 4
Points: 25NSP
RE: Help with Updating database from PHP? 07-27-2016, 09:31 PM
#11
(07-27-2016, 09:06 PM)Ex094 Wrote: Oh jeez, I think we got it. You forgot to add the Value attribute to the OPTION tags hence it's returning gamer_tag null I think
Replace this line:
Code:
echo "<option>" . $row['user_name'] . "</option>";
With this:
Code:
echo "<option value='" . $row['user_name'] . "'>" . $row['user_name'] . "</option>";
Also just in case to make sure inputs are coming correctly, Echo out all the POST variables like:
Code:
echo $gamertag;
echo $rank;
echo $tag;
echo $order;
Okay so it is doing it correctly by pulling in the values
Its outputting like tis
New records created successfully test Recruit [DSxR] 27
but it is still not updating it in the database
“I am thankful for all of those who said NO to me. It’s because of them I’m doing it myself.” – Albert Einstein
•
Ten Years of Service
Posts: 26
Threads: 4
Points: 25NSP
RE: Help with Updating database from PHP? 07-27-2016, 09:50 PM
#13
Ive never ran a query threw PHPMyAdmin . How could I run a statement with out having the form and all in it?
“I am thankful for all of those who said NO to me. It’s because of them I’m doing it myself.” – Albert Einstein
•
Ten Years of Service
Posts: 26
Threads: 4
Points: 25NSP
RE: Help with Updating database from PHP? 07-27-2016, 10:01 PM
#15
(07-27-2016, 09:34 PM)Ex094 Wrote: Then it might be that the mysql account you are using to query changes to the database does not have the UPDATE privilege, Try running the query in PHPMyAdmin, then see if the change gets applied there, it might be the permission problem
EDIT: I see your order field is an INT,
Try this line:
Code:
$stmt->bind_param("ssds", $_POST['select_rank'], $_POST['select_tag'], $_POST['select_order'], $_POST['select_gamertag']);
I hope you noticed, I made a mistake in my previous query that I provided for the bind_param, I accidentally added SELECT_ORDER twice and SELECT_GAMERTAG got neglected. I think that might be why it's not updating:
Code:
$stmt->bind_param("ssss", $_POST['select_rank'], $_POST['select_tag'], $_POST['select_order'], $_POST['select_gamertag']);
(07-27-2016, 09:55 PM)Ex094 Wrote: (07-27-2016, 09:50 PM)mudrig Wrote: Ive never ran a query threw PHPMyAdmin . How could I run a statement with out having the form and all in it?
First try out what I just said in the EDIT on my previous post, might as well work
Okay I changed it to that and now im getting this
No data supplied for parameters in prepared statement test Recruit [DSxP] 26
“I am thankful for all of those who said NO to me. It’s because of them I’m doing it myself.” – Albert Einstein
•
Ten Years of Service
Posts: 26
Threads: 4
Points: 25NSP
RE: Help with Updating database from PHP? 07-27-2016, 10:09 PM
#17
(07-27-2016, 10:05 PM)Ex094 Wrote: (07-27-2016, 10:01 PM)mudrig Wrote: Okay I changed it to that and now im getting this
No data supplied for parameters in prepared statement test Recruit [DSxP] 26
Did you try both?
Yes I tried both and got the same thing on each.
its almost like no data is being supplied to this now
Code:
$stmt = $conn->prepare("UPDATE users SET user_rank =?, user_tag =?, list_order =? WHERE user_name = '$gamertag'");
(This post was last modified: 07-27-2016, 10:16 PM by mudrig.)
“I am thankful for all of those who said NO to me. It’s because of them I’m doing it myself.” – Albert Einstein
•
Ten Years of Service
Posts: 26
Threads: 4
Points: 25NSP
RE: Help with Updating database from PHP? 07-28-2016, 03:35 AM
#19
Alright thanks for all the help I'll try this when I get home and let you know how it goes.
“I am thankful for all of those who said NO to me. It’s because of them I’m doing it myself.” – Albert Einstein
•
Ten Years of Service
Posts: 26
Threads: 4
Points: 25NSP
RE: Help with Updating database from PHP? 07-28-2016, 05:52 AM
#20
That worked. Looks like I just had the parameters backwards on that.
Now one more question since you have been so helpful. How would I make this form after submitted go back to same page and Display above form the result from the action of the form submit.
“I am thankful for all of those who said NO to me. It’s because of them I’m doing it myself.” – Albert Einstein
•