Jump to content

confusing problem


squiblo

Recommended Posts

nothing is being echoed in this code, and no errors, notices or warnings are appearing

 

<?php
session_start();
if($_SESSION['myusername']){
?>
<?php

$_SESSION['myusername'];

$connect = mysql_connect("localhost","***","***") or die ("Couldn't connect");
mysql_select_db("***") or die ("Couldn't find db");

$username = isset($_SESSION['myusername']) ? $_SESSION['myusername'] : 'default_value';

$query = mysql_query("SELECT * FROM members WHERE username='$username'");
if (mysql_num_rows($query)==0){
   die;
}else{
   $row = mysql_fetch_assoc($query);
   $location = $row['imagelocation'];
   if($location == ""){
      echo "";
   }else{
      echo "<img src ='$location' width='110' height='110' border='1'><br>";
  echo "Welcome " . ucwords(strtolower($_SESSION['myusername']));
   }
}
?>


<?php
}
else
{
echo "<a href='login.php' style='text-decoration:none'><font color=#FFFF00>Sign in </a></font><font color=#FFFFFF><font color=#000000>/</font> Register</font>";
}
?> 

Link to comment
Share on other sites

ive changed it a little bit so it may be easier to understand, i dont know how to get this to work properly, it is getting an image directory from mysql and the actual image is in ftp.

 

<?php
session_start();

if($_SESSION['myusername']){

$connect = mysql_connect("localhost","","") or die ("Couldn't connect");
mysql_select_db("") or die ("Couldn't find db");

$username = ($_SESSION['myusername']);

$query = mysql_query("SELECT * FROM members WHERE username='$username'");
if (mysql_num_rows($query)==0){
   die;
}else{
   $row = mysql_fetch_assoc($query);
   $location = $row['imagelocation'];
   if($location == ""){
      echo "";
   }else{
      echo "<img src ='$location' width='110' height='110' border='1'><br>";
  echo "Welcome " . ucwords(strtolower($_SESSION['myusername']));
   }
}

}
else
{
echo "<a href='login.php' style='text-decoration:none'><font color=#FFFF00>Sign in </a></font><font color=#FFFFFF><font color=#000000>/</font> Register</font>";
}
?> 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.