marksie1988 Posted October 24, 2007 Share Posted October 24, 2007 why does this script show information that isnt set in mysql the script with the isset function is still displaying the image when the field has no information in it. why? is it to do with my code below? <?php $req_user = trim($_GET['user']); if(!$req_user || strlen($req_user) == 0 || !eregi("^([0-9a-z])+$", $req_user) || !$database->usernameTaken($req_user)){ die("Username not registered"); } /* Display requested user information */ $req_user_info = $database->getUserInfo($req_user); /* Username */ echo "<strong>Username:</strong> <br>".$req_user_info['username']."<br><br>"; /* real name */ echo "<strong>Real Name:</strong> <br>".$req_user_info['rnme']."<br><br>"; /* Gender */ echo "<strong>Gender:</strong> <br>".$req_user_info['Gender']."<br><br>"; /* Age */ echo "<strong>D.O.B:</strong> <br>".$req_user_info['dob']."<br><br>"; /* Location */ echo "<strong>Location:</strong> <br>".$req_user_info['location']."<br><br>"; /* Info */ echo "<strong>Bio/Info:</strong> <br>".$req_user_info['info']."<br><br>"; echo "<strong>Other Stuff:</strong><br><br>"; if(isset($req_user_info['skype'])){ /* Skype */ echo "<a href='callto://".$req_user_info['skype'] ."'><img src='../images/icons/skype.gif' border='0'/></a>";} else{echo"";} if(isset($req_user_info['myspace'])){ /* myspace */ echo "<a href='http://".$req_user_info['myspace'] ."'><img src='../images/icons/myspace.gif' border='0'/></a>";} else{echo"";} if(isset($req_user_info['www'])){ /* myspace */ echo "<a href='http://".$req_user_info['www'] ."'><img src='../images/icons/www.gif' border='0'/></a>";} else{echo"";} ?> Quote Link to comment https://forums.phpfreaks.com/topic/74565-solved-why-isset-doesnt-seem-to-be-working/ Share on other sites More sharing options...
GingerRobot Posted October 24, 2007 Share Posted October 24, 2007 Because they are defined. They are just empty. Try: if(!empty($var)){ //echo the data } Also, next time, use tags(without the spaces) around your php code. Makes it a bit easier to read. Quote Link to comment https://forums.phpfreaks.com/topic/74565-solved-why-isset-doesnt-seem-to-be-working/#findComment-376854 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.