This is my edit script. When you login using the login script it will display a link with a value for $id to edit your information. This script (below) is giving me an invalid resource error (for $result). Something is apparently wrong with the SQL, but I am not sure what. Thanks in advance.
<?php
$id = $_GET['id'];
include("dbconn.php"); // Connect to the DB
if ($id) { // If the id is the same as in the db
if($submit) { // If submitted the form
$sql = "UPDATE characters SET cName='$txtName',cPass='$txtPass',cEmpire='$txtEmpire',cRank='$txtRank',cCRank='$txtCRank' WHERE id=$id";
$result = mysql_query($sql);
echo "Thank you, information updated.\n";
} else {
$sql = "SELECT FROM characters WHERE id=".$id."";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
}
}
?>
<form method="post" action="<?php echo $PHP_SELF?>">
First name:<input type="Text" name="txtName" value="<?php echo $myrow["cName"] ?>"><br>
Last name:<input type="Text" name="txtPass" value="<?php echo $myrow["cPass"] ?>"><br>
Address:<input type="Text" name="txtEmpire" value="<?php echo $myrow["cEmpire"] ?>"><br>
Position:<input type="Text" name="txtRank" value="<?php echo $myrow["cRank"] ?>"><br>
Position:<input type="Text" name="txtCRank" value="<?php echo $myrow["cCRank"] ?>"><br>
<input type="Submit" name="submit" value="Enter information">
</form>