I have the following function:
function assignOwnership($email, $lgeAbbrev, $teamAbbrev, $status, $db)
{
$marker = ACTIVE_USER_MARKER;
if($status == $marker)
$status = "'$marker'";
else
$status = "null";
$delOwnerQry = "delete from own where email='$email'";
$delTeamQry = "delete from own where lgeAbbrev='$lgeAbbrev' and teamAbbrev='$teamAbbrev'";
$addQry = "insert into own (email, lgeAbbrev, teamAbbrev, isActive) values ('$email', '$lgeAbbrev', '$teamAbbrev', $status)";
echo $addQry, "<br>\n"; // DEBUG - Show me the SQL statement I'm trying to run...
if(!mysql_query($delOwnerQry, $db) || !mysql_query($delTeamQry, $db) || !mysql_query($addQry, $db))
{
echo mysql_error();
return false;
}
return true;
}
This function is returning true, but the insert statement doesn't appear to be doing anything. When I look at the table after this function the new entry has not been added. I've printed out the SQL statement copied it and pasted it exactly as printed and it properly inserts the new record from the mySQL client. mysql_query() is returning 1 everytime which tells me that my query is properly formatted and is being executed, but the record is not being added. Any ideas as to why it's not being added?
Help appreciated,
Derek
function assignOwnership($email, $lgeAbbrev, $teamAbbrev, $status, $db)
{
$marker = ACTIVE_USER_MARKER;
if($status == $marker)
$status = "'$marker'";
else
$status = "null";
$delOwnerQry = "delete from own where email='$email'";
$delTeamQry = "delete from own where lgeAbbrev='$lgeAbbrev' and teamAbbrev='$teamAbbrev'";
$addQry = "insert into own (email, lgeAbbrev, teamAbbrev, isActive) values ('$email', '$lgeAbbrev', '$teamAbbrev', $status)";
echo $addQry, "<br>\n"; // DEBUG - Show me the SQL statement I'm trying to run...
if(!mysql_query($delOwnerQry, $db) || !mysql_query($delTeamQry, $db) || !mysql_query($addQry, $db))
{
echo mysql_error();
return false;
}
return true;
}
This function is returning true, but the insert statement doesn't appear to be doing anything. When I look at the table after this function the new entry has not been added. I've printed out the SQL statement copied it and pasted it exactly as printed and it properly inserts the new record from the mySQL client. mysql_query() is returning 1 everytime which tells me that my query is properly formatted and is being executed, but the record is not being added. Any ideas as to why it's not being added?
Help appreciated,
Derek