Saturday, September 6, 2014

USE SINGLE QUERY FOR UPDATE STATUS OF ANY ENUM

Create table feedback (
fid int(3),name varchar2(30),
email varchar(20),subject varchar(30),
satatus enum('0','1')); 

UPDATE feedback SET status =  
CASE
  WHEN  1 THEN 0
  WHEN 0 THEN 1
END
WHERE fid = 3;
 
 

SELECT CASE is_status
      WHEN
1 THEN 'Replied'
      WHEN
0 THEN 'Not Replied'
      
END AS 'fstatus'
FROM feedback
;

Tuesday, September 2, 2014

DISPLAY DIV USING NONE AND BLOCK IN JAVASCRIPT

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DISPLAY USING NONE AND BLOCK</title>
</head>

<body>
<script language="JavaScript">
function setDisplay(id,attribute){
document.getElementById(id).style.display = attribute;
}
</script>

<div id="register" style="display: block;">
<input onclick="setDisplay('myform', 'block');setDisplay('register', 'none');" type="button" value="Register Now" />
</div>

<div id="myform" style="display: none;">
<table>
<tr>
<td>Userid:</td>
<td><input name="userid" TYPE="text" SIZE="20" MAXLENGTH="20"></td>
</tr>
<tr>
<td>Password:</td>
<td><input name="password" TYPE="password" SIZE="20" MAXLENGTH="20"></td>
</tr>
<tr>
<td>Name:</td>
<td><input name="name" TYPE="text" SIZE="30" MAXLENGTH="30"></td>
</tr>
<tr>
<td>Email:</td>
<td><input name="email" TYPE="text" SIZE="50" MAXLENGTH="50"></td></tr>
</table>
<input onclick="setDisplay('myform', 'none');setDisplay('register', 'block');" type="button" value="Go Back" />
</div>
</body>
</html>

SHOW AND HIDE DIV USING JAVASCRIPT

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hide and display</title>
<script language="javascript">
function hideform(id,attribute)
{
document.getElementById(id).style.visibility= attribute;
}
</script>
</head>
<body>
<a href='#' onclick="hideform('loginfrm','visible')" >For login Click Here</a>
<div id='loginfrm' style="visibility:hidden;">
<form name='frm' action="login.php" method="post">
<table>
<TR><TD>Enter UserName:</TD><TD><input type="text" name="uname" /></TD></TR>
<TR><TD>Enter Password:</TD><TD><input type="text" name="upass" /></TD></TR>
<TR><TD><input type="submit" name="login" value="login"/></TD>
<TD><a href="#" onclick="hideform('loginfrm','hidden')">Close</a></TD></TR>
</table>
</form>
</div>
</body>
</html>