I would like to create a php script where I am able able to do
http://example.com/main.php?add=[$id + 1]
It connects to a mysql database. $id is an integer, lets just say the value is 1 (just to be an example). I want it to gather the $id from a mysql table called scriptid. (column 0) I want it to select the column from a mysql table called scriptlist. I want the column number to be the value of $id + 1, e.g http://example.com/main.php?add=2. When it does 'add' it will change the value of the column entered ($id + 1) to 1.
So far I have this, I am new to both php and mysql and am very confused, even after reading loads of guides.
$id = $_GET["id"];
$check = mysql_query("SELECT * FROM scriptlist");
$rowlist = mysql_fetch_row($check);
if($rowlist) {
mysql_query("UPDATE scriptlist SET user = 'dan' WHERE " . $rowlist['$id'] + 1 . " = '1'");
echo($rowlist['$id'] + 1 . " = '1'");
}
I don't think my code will actually help you understand it more, but yeah.