spiceydog Posted July 21, 2008 Share Posted July 21, 2008 I have this script that is supposed to take the get data and then do some stuff. You will easily be able to tell what it's supposed to do because it's a very simple script. Here is my script: <?php $result = mysql_query("SELECT * FROM comments WHERE id = '$post' LIMIT 0, 1"); while($row = mysql_fetch_array($result)) { $cpost = $row['post']; $cuser = $row['user']; $result2 = mysql_query("SELECT * FROM albuminfo WHERE post = '$cpost' GROUP BY albumname"); while($row2 = mysql_fetch_array($result2)) { $user = $row2['user']; if (($cuser == $username) || ($user == $username)) { mysql_query("DELETE FROM comments WHERE id = '$post'"); header("Location: viewpost.php?id=$cpost"); } else { echo "<script language='JavaScript' type='text/javascript'>alert('Stop trying to delete comments that arent on your posts.'); location = 'viewpost.php?id=$cpost';</script>"; exit; } ?> I also echoed the following and got the following results (i am logged in with the username "account"): $cuser = account2 $user = account $username = Account $cpost = 4 Now it seems to me like this should work... but it just opens the popup and continue on it's way... Link to comment https://forums.phpfreaks.com/topic/115797-if-clause-not-working-mysql-query-not-working-well-something-isnt-working/ Share on other sites More sharing options...
samshel Posted July 21, 2008 Share Posted July 21, 2008 no harm in trying this? if ((strtolower($cuser) == strtolower($username)) || (strtolower($user) == strtolower($username))) Link to comment https://forums.phpfreaks.com/topic/115797-if-clause-not-working-mysql-query-not-working-well-something-isnt-working/#findComment-595286 Share on other sites More sharing options...
spiceydog Posted July 21, 2008 Author Share Posted July 21, 2008 erm... thank you! but... why does that work? I thought MySQL wasnt case sensitive? Link to comment https://forums.phpfreaks.com/topic/115797-if-clause-not-working-mysql-query-not-working-well-something-isnt-working/#findComment-595298 Share on other sites More sharing options...
samshel Posted July 21, 2008 Share Posted July 21, 2008 MySQL is not, but PHP is..and your condition is in PHP you can use strcasecmp() too... Link to comment https://forums.phpfreaks.com/topic/115797-if-clause-not-working-mysql-query-not-working-well-something-isnt-working/#findComment-595318 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.