$Sql = "UPDATE clans SET name = '$clanName', details = '$clanDetails', website = '$url', image = '$imagePic', clanTag = '$clanTag', email = '$email' WHERE ID = '$clanID'";
$im = "yes";
}
}
}
else
{
$Sql = "UPDATE clans SET name = '$clanName', details = '$clanDetails', website = '$url', clanTag = '$clanTag', email = '$email' WHERE ID = '$clanID'";
$im = "no";
}
if (count($errors) > 0)
{
foreach ($errors as $a => $b)
{
echo $a." - ".$b."<br />";
}
}
else
{
//UPDATE Query//
$Res = mysql_query($Sql);
if ($Res)
{
header("Location: ClanDetails.php?ID=$clanID&$im&$Sql");
}
else
{
echo "There was an error";
}
}
When i run it it redirects to the clandetails page, and the SQL is valid (tried it in phpMyAdmin and it works) and it says yes (The yes no was to see if it was going through the picture upload section).
Is there something up with the if ($Res) part of my code? Could it be done a better way? That seems like the only reason its doing this.
The DB connection file is included at the start of the code.
If you want to see all the code before just say and ill post is but its about an extra 100 lines :P
To encapsulate the text values... as you should. Though they should be passed through mysql_real_escape_string().
You should be echoing $Sql to see the query; $Res is the return value from mysql_query().
Thats what i did at first, i echoed the query, and ran it through phpMyAdmin and it worked, no errors or anything which makes it all that more confusing to me.
Thats what i did at first, i echoed the query, and ran it through phpMyAdmin and it worked, no errors or anything which makes it all that more confusing to me.
So everything is working properly? You said it wasn't updating, but the query succeeds. Are you actually changing anything? If you specify the same values mysql_query() will return true even if nothing changes. You can use mysql_affected_rows() to see if something was changed.
Yeah i do change values, what i mean is if i run the echoed query in phpMyAdmin updates, yet if i run it through my website it doesnt, but the mysql_query still returns true
Sorry about the slow reply. The $Sql is this "UPDATE `clans` SET `name` = 'ATestClan!', `details` = 'ATC!', `website` = '', `image` = 'tomharto1-10003.gif', `clanTag` = 'ATC', `email` = '' WHERE `ID` = '11'";
I also added the or die... bit and it didnt die.
Also, i know the website and email values are empty, i didnt enter anything for them in the form
$Res = mysql_query($Sql) or die(mysql_error()); if (!$Res) { echo "There was an error"; } else { header("Location: ClanDetails.php?ID=$clanID&$im&$Sql"); } }
} else {
} }
Thats all the code above what ive already posted.
Anyone see any issues there as to why this problem is happening?