Thank you very, very, much help is always really appreciated a LOT.
Whenever it finds the same user name in the address bar as it finds in the database, it will add a 'v' to the database if the refresh button is clicked on. That tells me it's reading a lot of the code. Otherwise no 'v' would even be sent to the database.
Maybe I should explain I'm not a better coder probably obviously why I needed to come here, because I need some help. It's been many, many months since I've been here. Maybe even a year I had to muddle through with difficulty what I learned before, to try to build a website. With economy decided I needed to work on it some more because it was going nowhere. Do notice when basics seems like they should really be working though. If someone can help explain to me also why something that is already there is not working, when seems to me like they really should be. Because if I tried to do a lot of extra steps that I don't know why I'm doing them, so I don't know how to do right as well. I'd only ruin the code because I don't understand it and don't know how to do it, and end up right back where I started with non working code. Even with your great notes that you were very nice enough to add to help me understand, that I studied hard I'm not a great enough coder to know why some of it is needed and know how to fix it. If I understand why something needs done, then it's a lot easier for me to try to fix it or to use someone's great tips. Otherwise I'm shooting in the dark.
Because of those things, I know why I might need to do extra steps but not sure why I would need to do some or many. Someone here long time ago helped me build the below code. Maybe some can tell me, seems like this is doing several of the same thing that was built with help below. Even though I really appreciate a lot, anyone that is nice enough to try to help me, to explain some of why I'm confused, would help to know why I need to put it into something like 'un' and some other extra steps when it seems like it's already asking for some of them. Looks like it's asking below already,
if (isset($_GET['username']))
// If user name is in browser address bar, then put v in database with the same exact username. Seems like is already saying that in code below.
<?PHP
$con = mysql_connect("", "databaseinfo", "");
if (!$con) {
die('Could not connect: ' . mysql_error());
}else{
mysql_select_db("databaseinfo", $con);
}
if (isset($_GET['username'])) {
$sql = "UPDATE `add` SET `v` = 'v' WHERE username = '" . $_GET['username'] . "'";
$result = mysql_query($sql);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
if ($result) {
echo "Your data validated.";
}else{
echo "Your entry did not validate...then info what to do if that happens" . mysql_error();
}
}
?>
But found out something else is wrong in the above, if it helps to know another error I found in code above. If that might help to explain what the other error might be as well or not.
$result = mysql_query($sql);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
Because just as another test, I put a user name in the browser adress bar that was not in the database. And it still said 'Your data validated' on the page when it shouldn't have. Because nothing would have been able to send to the database. It should not have said it validated, there should have been an error message. It also didn't give me any error messages of any kind on the page, like it should have as well. Makes me think it might be some clue that something is wrong with the way,
$result = mysql_query($sql);
..is written as well. But as I look over and over it and look in the PHP Manual. I can't figure out what the error is in '$result' in the php code. Why it's not showing error like it should, when there is no user name found in the database. Why it's not sending 'v' to the database unless the refresh button is clicked on manually as well.
It's difficult to know how to fix someone's harder code if I don't understand a lot of their own code they wrote. Then it is to try to fix real basic code, that I do understand quite a bit of it. Even if it's not all. Only trying hard on what I'm able understand and some that I don't, I'm not smart enough to become a real programmer doing the best I can. Hope that makes sense to someone.