Ok,I've made a script that updates data(targetid) in the database based on a user's id.First I want to make it so I can update all of the user's "targetid"s(as an admin feature) and lastly I want to make it so that if a user is the last in the DB his targetid becomes 1
Here's my code
<?php
session_start();
/**
* @author kostis
* @copyright 2009
*/
if (isset($_SESSION['Alias']))
{
include ('database/connect.php');
$target = mysql_query("SELECT * FROM players WHERE alias = '" .$_SESSION['Alias'] . "'");
mysql_real_escape_string($_SESSION['Alias'] . "'");
$result = mysql_fetch_array($target);
$id=$result['id'] +1;
mysql_query("UPDATE players SET Targetid = '$id' WHERE Alias = '" .$_SESSION['Alias'] . "'") or die(mysql_error());
}
else
{
echo "session's not working";
}
?>
If you need anymore info,just tell me.
I'd really appreciate your help.
Thanks in advance