PHP photo else/if picking
<p>Hello there im having little problem with else if i can't figure out the 'else if' i want to make it if the</p>

<pre><code>$photo = 'http://www.localhost/uploads/'.$usersInfo['image_id'].'.jpg';
$photoModeImage = 'http://www.localhost/uploads/thumbs/'.$usersInfo['image_id'].'.jpg';
</code></pre>

<p>goes wrong then else if should pick the photos</p>

<pre><code>&lt;?php
require_once '../../../common/server/php/settings.php';



//Connect to users database
$db = mysql_connect('localhost','root','123456') or die(mysql_error());
mysql_select_db('registracija',$db) or die(mysql_error());

//Init request parameters
$userName = (isset($_REQUEST["user_name"])) ? urldecode($_REQUEST["user_name"]) : "";
$password = (isset($_REQUEST["password"])) ? urldecode($_REQUEST["password"]) : "";
$uid = (isset($_REQUEST["uid"])) ? urldecode($_REQUEST["uid"]) : "";
$pwdmd5 = md5($password);

//Check if user filled login and password in the login screen (Chat authorization)
if($userName != "" &amp;&amp; $password != "")
{
  $sql = "SELECT * FROM users WHERE username='".$userName."' AND password='".$pwdmd5."'";
}
//session/cookie base authorization (Auto login)
else if ($_SESSION['user_id']!="")
{
  $sql = "SELECT * FROM users WHERE Profile_id='".$_SESSION["user_id"]."'";
}
// Non session/cookie based autologin authorization
else if ($uid!="")
{
  $sql = "SELECT * FROM users WHERE id='".$_GET['uid']."'";
}
else
{
  echo '&lt;auth error="AUTH_ERROR" /&gt;';
  exit;
}

//Select user data
$result = mysql_query($sql,$db);

if(mysql_num_rows($result)==1)
{
  //User found. get user info
  $usersInfo = mysql_fetch_array($result);
  if($userInfo['image_id'] ==''){
    $photo = FLASHCOMS_HTTP_ROOT.'common/images/User1_120.png';
    $photoModeImage = FLASHCOMS_HTTP_ROOT.'common/images/User1_40.png';  
  }
  else{
    $photo = 'http://127.0.0.1:8082/uploads/'.$usersInfo['image_id'].'.jpg';
    $photoModeImage = 'http://127.0.0.1:8082/uploads/thumbs/'.$usersInfo['image_id'].'.jpg';
  }
  $answer = '&lt;auth&gt;';
  $answer .= '&lt;userName&gt;&lt;![CDATA['.$userName.']]&gt;&lt;/userName&gt;';
  $answer .= '&lt;gender&gt;male&lt;/gender&gt;';
  $answer .= '&lt;age&gt;'.$userInfo['age'].'&lt;/age&gt;';
  $answer .= '&lt;level&gt;regular&lt;/level&gt;';
  $answer .= '&lt;photo&gt;&lt;![CDATA['.$photo.']]&gt;&lt;/photo&gt;';
  $answer .= '&lt;photoModeImage&gt;&lt;![CDATA['.$photoModeImage.']]&gt;&lt;/photoModeImage&gt;';
  $answer .= '&lt;/auth&gt;';
  echo $answer;
  exit;
}
else 
{
  //User not found OR authorization failed
  echo '&lt;auth error="AUTH_ERROR" /&gt;';
  exit;
}

?&gt;
</code></pre>

<p>what i need to make it work is </p>

<pre><code>else if ($photo['$image_id']!='')
    {

    $photo = FLASHCOMS_HTTP_ROOT.'common/images/no_photo.png';
    $photoModeImage = FLASHCOMS_HTTP_ROOT.'common/images/no_photo.png';
</code></pre>

<p>but images are not showing.</p>

<pre><code>-- ----------------------------
-- Table structure for `users`
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
  `id_user` int(11) NOT NULL auto_increment,
  `name` varchar(128) NOT NULL,
  `email` varchar(64) NOT NULL,
  `age` varchar(16) NOT NULL,
  `username` varchar(16) NOT NULL,
  `password` varchar(32) NOT NULL,
  `confirmcode` varchar(32) default NULL,
  `gender` varchar(32) NOT NULL,
  `country` varchar(20) NOT NULL,
  `city` varchar(20) NOT NULL,
  `about_me` varchar(200) NOT NULL,
  `image_id` varchar(10000) NOT NULL,
  PRIMARY KEY  (`id_user`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES ('1', '', 'localhost@myemail.com', '', 'Mentro', '5f4dcc3b5aa765d61d8327deb882cf99', 'y', '', '', '', '', '1');
</code></pre>
