Jump to content

whats wrong with my code?


therelelogo

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/206433-whats-wrong-with-my-code/
Share on other sites

<?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]";



}
?>

$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');

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.