I have made a php/mysql code as follows, it chooses whether the content is to be shown or hidden, only it doesnt seem to work, can someone help me with it or make me a new one

If you don't get what im talking about, the user clicks a link, this link either shows or hides content, and the data is stored in a MYSQL database, in relationship with their IP
MYSQL

Code:
CREATE TABLE `hideshow` (
  `members` varchar(130) NOT NULL default '',
  `members1` varchar(130) NOT NULL default '',
  `ip` varchar(130) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" language="javascript">
function ajaxRequest_fun()
{
    var ajaxRequest;
    
    try
    {
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
        return ajaxRequest;
    }
    catch (e)
    {
        // Internet Explorer Browsers
        try
        {
            ajaxRequest = new ActiveXObject('Msxml2.XMLHTTP');
            return ajaxRequest;
        }
        catch (e)
        {
            try    
            {
                ajaxRequest = new ActiveXObject('Microsoft.XMLHTTP');
                return ajaxRequest;
            }
            catch (e)
            {
                alert('something wrong');
                return false;
            }
        }
    }
}

function switch_view(id, display)
{
    switch_viewRequest = ajaxRequest_fun();
  // DOM3 = IE5, NS6
  if (document.getElementById) {
    document.getElementById(id).style.display = display;
  // Netscape 4
  } else if (document.layers) {
    document.layers[id].display = display;
  // IE 4
  } else if (document.all) {
    document.all[id].style.display = display;
  }
      if(display == "none")
    {
         getbyID(id + '_link').href = getbyID(id + '_link').href.replace('none', 'block');
    }
    else
    {
        getbyID(id + '_link').href = getbyID(id + '_link').href.replace('block', 'none');
    }
    switch_viewRequest.open('GET', "tut.php?action=update&name=" + id + "&value=" + display, true);
    switch_viewRequest.send(null);
}
//Function from Zvoters http://www.thetechex.net
function getbyID(id)
{
    var box= '';
    if(document.all && !document.getElementById)
    {
        return box = document.all.id;
    }
    else if(document.getElementById)
    {
        return box = document.getElementById(id);
    }
    else
    {
        return box = document.layers[id];
    }
}
</script>
</head>
<?php
    error_reporting
(E_ALL & ~E_NOTICE);
    
mysql_connect("localhost""db_username""db_password") or die("Could not connect to MySQL");
    
mysql_select_db("db_name") or die("Could not connect to MySQL");
    
$ip getip();
    
$query mysql_query("SELECT * FROM hideshow WHERE ip='$ip'");
    
$info mysql_fetch_array($query);
    if(!
$info)
    {
        
$info['members'] = "block";
        
$info['members1'] = "block";
    }
    
    echo 
"<body onload=\"switch_view('members','".$info['members']."'); switch_view('members1','".$info['members1']."')\">\n";
    echo 
"<a id=\"members_link\" href=\"javascript:switch_view('members','".$info['members']."')\">Show/Hide</a><div id=\"members\">content</div><br/>";
    echo 
"<a id=\"members1_link\" href=\"javascript:switch_view('members1','".$info['members1']."')\">Show/Hide</a><div id=\"members1\">content</div>";
?>
</body>
</html>
<?php
if($_GET['action'] == "update")
{
    
$value addslashes($_GET['value']);
    
$name addslashes($_GET['name']);
    
$ip getip();
    
    
$query mysql_query("SELECT * FROM hideshow WHERE ip='$ip'");
    if(
mysql_num_rows($query) == 0)
    {
        
mysql_query("INSERT INTO hideshow VALUES ('$value','block','$ip')");
    }
    else
    {
        
$update_query mysql_query("UPDATE hideshow SET $name='$value' WHERE ip='$ip'");
    }
}
function 
getip()
{
    if(
$_SERVER['HTTP_X_FORWARDED_FOR'])
    {
        return 
$_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    elseif(
$_SERVER['REMOTE_ADDR'])
    {
        return 
$_SERVER['REMOTE_ADDR'];
    }
    else
    {
        return 
$_SERVER['HTTP_CLIENT_IP'];
    }
}
?>