
December 11th, 2012, 11:23 AM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 13
Time spent in forums: 1 h 33 m 37 sec
Reputation Power: 0
|
|
|
Mysql query returns null value
I have code that runs two mysql queries. The second query depends on the result of the first returning true. This works fine, that is to say the value of $result is true and the code moves to the next query. However when the second query runs, which it does and works, it returns a null value for $result.
In testing the code I added some echo statements. The first just shows the value "RESULT". The second, Records deleted showed a -1 value for the affected rows, when in fact one record was deleted. As I said, the both queries work fine.
Can someone tell me why the result value for the second query is null and why the number of record affect = -1?
Thanks,
Tom
$query = DeleteTerm($TermID);
$result = mysql_query($query);
if ($result)
{
$query = DeleteTermFromGroupTermLink($TermID);
$result = mysql_query($query);
echo "RESULT " . $rc . "<br/>";
echo "Records deleted: ", mysql_affected_rows();
if ($result)
{
$lblMessage = "Delete Term Was Successful.";
}
else
{
$lblErrMessage = "Delete Term Encountered An Error. Please Try Again.";
}
}
else
{
$lblErrMessage = "Delete Term Encountered An Error. Please Try Again.";
}
|