hiding or showing a div depending on values fetched from a database

Thursday, July 3, 2014

I have a table with a column of registration.When user log's into his/her account,a value of unregistered is inserted into the registration column.The user then proceeds and register his/her account and the value in the registration column is updated to registered.I need to return true when the user is registered and change the value in a particular div from unregistered to registered and hide the registration link to the page for registration using Jquer` as in code three.In addition return false when the user is unregistered.The code one below is functioning when i manually change the id of the user as shown below but when i use the user's id in session as shown in code two,only return false is executed.I need a person to assist me please.The jquery code below is functioning with php code one.

Code one is functioning but the id's i have to change them manually.
**code one**

Code two does not execute. code two

require'connection.php';//connection to the database
require'user_getfield.php';//function to get user data in session,functioning



$query="select `account_id` from `user_account` where `register`='$register' and `account_id`='$user_id'";

if($row == 1){
echo 'registered';
else if($row== 0){
echo 'unregistered';

Code three below is the jquery code.When a return true is executed,the div value changes from unregistered to registered and the registration link is hidden from the being accessed.

jquery code three $(document).ready(function() { var register='registered';

$('#welcome_div').html('YOU ARE REGISTERED').css('background','blue');
else if(data=='unregistered'){
$('#welcome_div').html('FINISH REGISTRATION').css('background','red');