Jump to content

If then else statement not working


Recommended Posts

This is my code

 

welcome.php

<?php
session_start();
require_once('global.php');
$is_id = $_SESSION['userid'];
$query = "SELECT * FROM mf_user WHERE ID = '{$is_id}' ";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
$image_select = $row['visits'];
$smarty = new MySmarty();
$smarty->assign('visits',$image_select);
$smarty->assign('title', SITE_TITLE.' :: Cast');
$smarty->assign('site_title', SITE_TITLE);
$smarty->assign('base_url', BASE_URL);
$smarty->assign('tpl_url', BASE_URL.TPL_URL."default/");
$smarty->assign('hiddenstr', $hiddenstr);
//right side data
require_once('right_data.php');
//right side data
echo $image_select;
$smarty->display('welcome1.htm');
?>

 

and this is welcome.htm

  <html>
  <head>
  <title>.:Asia Underworld:.</title>
  <meta name="author" CONTENT="tom">
<link href="../../css/main.css" rel="stylesheet" type="text/css"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
{literal}
body {
background-image: url(../../images/indexbg.jpg);{/literal}
}
-->
</style>
  {include file="css_js.htm"}
  </head>
  <body onLoad="grabit()" onkeypress="screenshotHide(event)">
  <div id="dhtmltooltip"></div>
  <p> </p>
  <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="cat">
  	{include file="header.htm"}
  <tr>
  <td width="120" background="" valign="top">
   {include file="left.htm"}
  </td>
  <td width="99%" background="" bgcolor="#333333" valign="top"><p> </p>
    <table width="75%" align="center" cellpadding="0" cellspacing="0" class="cat">
    <tr>
      <td height="20" class="headerbar">- Welcome!</td>
    </tr>
    <tr>
      <td class="sub3"><div align="center">
        <p> </p>
        <p><img src="../../images/test.png" width="500" height="150"></p>
        <p>{if ($image_select < 2)}<img src="../../images/welcome1.jpg" width="500" height="500">{else}<img src="../../images/welcome2.jpg" width="500" height="500">{/if}</p>
        <p> </p>
      </div></td>
    </tr>
  </table>    
    <p><br>
  </p>
  </td>
  <td width="120" background="" valign="top">
  {include file="right.htm"}
  </td>
  </tr>
  </table>
</body>
</html>

 

this statement does not seem to work

        <p>{if ($image_select < 2)}<img src="../../images/welcome1.jpg" width="500" height="500">{else}<img src="../../images/welcome2.jpg" width="500" height="500">{/if}</p>

 

it always shows welcome1.jpg,

i have echoed out the variable and it says four.

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.