I have a problem with redirection using php. Basically when a user clicks this button they are taken to "proofprocess.php" which is a series of MySQL calculations changing user values.
I want to queries to run then direct back to the page the user was last on. I done it like this
Code: Select all
<?
$sql = "SELECT `proof`.*,
`users`.*
FROM `proof`,`users`,`fulldata`
WHERE users.id = $id
AND proof.userproof_id = $id
AND proof.job_id = $_GET[jid]";
$result = mysql_query($sql)
or die('Invalid query: ' . $sql . ' - Error is ' . mysql_error());
$sql = "UPDATE `users`,`proof`
SET clickstatus = 1
WHERE proof.userproof_id = $id
AND proof.job_id = $_GET[jid]";
$result = mysql_query($sql)
or die('Invalid query: ' . $sql . ' - Error is ' . mysql_error());
$sql = "UPDATE `users`,`proof`
SET user_earning = user_earning + perperson
WHERE users.id = $id
AND proof.job_id = $_GET[jid]";
$result = mysql_query($sql)
or die('Invalid query: ' . $sql . ' - Error is ' . mysql_error());
$sql = "UPDATE `users`
SET jobs_completed = jobs_completed + 1
WHERE id = $id";
$result = mysql_query($sql)
or die('Invalid query: ' . $sql . ' - Error is ' . mysql_error());
header( "Location: http://www.myurl.com/jobproof.php?ID=$_REQUEST[jid]") ;
?>