What am i doing wrong with the script below? What i am trying to do is check
whether the "newtest" field has a 0 or a  1 value then redirect the user to
a different page based on the answer.

I am then trying to add 2 to the value in the "points" field of my database
and then  to set the "newtest" field value to 1 so the user is directed to
the second of the two pages if they click the link again

My database is MySQL and the connection details are correct and stored in an
external script.  I have missed out the PHP tags on the code below in case
that interferes with how it appears on the list.  I really would appreciate
any help with this as i am a newbie to MySQL and PHP and am finding it a
really steep learning curve.  Thanks.

Steven M
-------------------------------------------------------
include 'db.php';

$result = mysql_query("SELECT newtest FROM users WHERE 14 = '$0'");
list($number) = mysql_fetch_row($result);
mysql_close();

if($number==0)
{mysql_query("UPDATE users SET points = '$+2' WHERE 14 = '$0'");
mysql_query("UPDATE users SET newtest = '$1' WHERE newtest = '$0'");
header("Location: redirect1.php");
}
elseif($number==1)
{
header("Location: redirect2.php");
}
else
{
header("Location: error.php");
}
-------------------------------------------------------




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to