Hello, I'm trying to update information in a database through a form but I have very limited knowledge in PHP/SQL. I'm using an example given on the W3School website, but it needs editing and I don't have a clue how to do it.
Example script:
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
mysql_query("UPDATE Persons SET Age = '36'
WHERE FirstName = 'Peter' AND LastName = 'Griffin'");
mysql_close($con);
?>
My attempt to change it: (Does not work, no errors given)
<?php
$con = mysql_connect("localhost","name","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_database", $con);
mysql_query("UPDATE roster_basic SET callsign, rank, location = '[new_username]','[new_rank]','[new_location]'
WHERE callsign = '[old_username]'");
mysql_close($con);
?>
I need to be able to enter the old user name (that I want to edit) into a text field, then the new information into three more fields. I would appreciate it very much if anybody could shed some light onto this situation or even rewrite the "mysql_query" part.
Thank you
MissileMoose