therelelogo Posted July 1, 2010 Share Posted July 1, 2010 hi, a little confused why my code doesn't seem to work: <?php // Connect to MySQL // Delete Bobby from the "example" MySQL table mysql_query("SELECT email_add_public FROM members WHERE login='{$_SESSION['SESS_LOGON_NAME']}'") or die(mysql_error()); if ($mysql_query == 'NO') { echo"[make public]"; }else if (email_add_public == 'YES') { echo"[make private]"; } ?> i've also tried single and double "=" with $mysql_query and email_add_public and it just doesnt seem to return anything? any help appreciated thanks Quote Link to comment https://forums.phpfreaks.com/topic/206433-whats-wrong-with-my-code/ Share on other sites More sharing options...
ejaboneta Posted July 1, 2010 Share Posted July 1, 2010 <?php // Connect to MySQL // Delete Bobby from the "example" MySQL table $query = mysql_query("SELECT email_add_public FROM members WHERE login='{$_SESSION['SESS_LOGON_NAME']}'") or die(mysql_error()); $fetch = mysql_fetch_array($query); if ($fetch[email_add_public] == 'NO') { echo"[make public]"; }else if ($fetch[email_add_public] == 'YES') { echo"[make private]"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/206433-whats-wrong-with-my-code/#findComment-1079917 Share on other sites More sharing options...
therelelogo Posted July 3, 2010 Author Share Posted July 3, 2010 hi, thanks for the answer, but it still didn't work any other suggestions? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/206433-whats-wrong-with-my-code/#findComment-1080843 Share on other sites More sharing options...
ignace Posted July 4, 2010 Share Posted July 4, 2010 $result = mysql_query("SELECT UPPER(email_add_public) FROM members WHERE login='{$_SESSION['SESS_LOGON_NAME']}'"); if(false !== $result && 0 !== mysql_num_rows($result)) { list($email_add_public) = mysql_fetch_row($result); switch($email_add_public) { case 'NO' : echo 'NO'; break; case 'YES': echo 'YES'; break; } } else echo('No such record'); Quote Link to comment https://forums.phpfreaks.com/topic/206433-whats-wrong-with-my-code/#findComment-1080954 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.