Posts: 16
Threads: 3
Joined: Dec 2012
Reputation:
0
Hey guys, I'm currently trying to learn how to get better at PHP coding and am making a system for a server I play on's Sheriffs Department for dispatching. I am having a bit of trouble doing a few things. I need to find out what to put to modify a mysql column. The name of columns are badge and status. I already have the other stuff sorted out, to get the username from where it's typed in the box, but need to know what to put meaning the second section is either "Set Badge" or "Set Status" and I need to make it so it changes that in the mysql for their row. (Sorry if I confused you :P)
Thanks in advance.
SIMLIFIED:
How do I make it so whatever I input to the text box is what the specified mysql column changes to
Posts: 2,286
Threads: 18
Joined: Jun 2010
Use an HTML form or AJAX, up to you. Most importantly, make sure you don't allow SQL injection.
Posts: 596
Threads: 8
Joined: Jan 2013
Reputation:
0
Would be best to use AJAX.
Posts: 952
Threads: 45
Joined: Aug 2010
Reputation:
0
INSERT to insert a record
UPDATE to update a record
To do what you want use the UPDATE function.
For example
This is a textboxl:
-------------------------------------------
| Set Badge |
| #9582 |
Button:
-----------
| Submit |
-----------
When you use the UPDATE function it will update the X record.
So lets you're an admin you logged in you want to set an officers b adge number.
You go to lets say..
Admin CP >> Set Badge.
"Enter Officers Name"
"Mark_Weston" and lets say my account is user id 857
setbadge.php?userid=857
This shows up:
-------------------------------------------
| Set Badge |
| # |
Button:
-----------
| Submit |
-----------
You enter a badge number press submit
and the UPDATE record will insert the new badge number into the SQL.
Its kind of hard to explain, but is that what you want to do?
That's how I made my web based MDC.