Switch between two javascript functions
<p>basically I want php to decide which version of the site pieces to load
something along the lines of:</p>

<pre><code>    &lt;?php 

    $sql="SELECT _1 FROM Player_Registry WHERE Player_Name = $_SESSION[user_name]"; 
    $result_1=mysql_query($sql); 
    if($result_1 &lt; 10) { ?&gt; 
      &lt;script type="text/javascript"&gt; 
        function setdescription_1() { 
          document.getElementById('title_box').innerHTML = 'Alchemist'; 
        } 
      &lt;/script&gt; 
    &lt;?php 
    } 
    else { 
    ?&gt; 
      &lt;script type="text/javascript"&gt; 
        function setdescription_1() { 
          document.getElementById('title_box').innerHTML = 'Master Alchemist'; 
        } 
      &lt;/script&gt; 
    &lt;?php 
    }?&gt; 
</code></pre>

<p>issue is that they both run so even if I set the condition to true I still get the second.</p>

<p>The complete source which is identical to what is being viewed-as-source as far as I can tell but none of the php shows up in the site preview (it is actually there though because my other computer can view the site without seeing the php but when it views source it can see it which it shouldn't be able to):
    </p>

<pre><code>&lt;head&gt;

&lt;title&gt;Blank&lt;/title&gt;

&lt;link rel="icon" type="image/png" href="Pictures/favicon.png"&gt;

&lt;meta name="description" content="" /&gt;

&lt;meta name="keywords" content="" /&gt;

&lt;meta name="author" content="" /&gt;

&lt;meta name="owner" content="" /&gt;

&lt;meta name="copyright" content="" /&gt;

&lt;meta http-equiv="content-type" content="text/html;charset=UTF-8" /&gt;

&lt;link rel="stylesheet" href="TreeStyle.css" type="text/css" /&gt;
&lt;/head&gt;

&lt;body&gt;


&lt;div style="width:100%; height:12.5%;"&gt;
    &lt;p style="font-size: 300%;"&gt;&lt;b&gt;Skill Tree: Alchemist&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div style="width:100%; height:75%;"&gt;
&lt;?php
$sql="SELECT _1 FROM Player_Registry WHERE Player_Name = $_SESSION[user_name]";
$result_1=mysql_query($sql);
if($result_1 &lt; 10)
    {
    ?&gt;
    &lt;script type="text/javascript"&gt;
    function setdescription_1()
        {
        document.getElementById('title_box').innerHTML = 'Alchemist';
        document.getElementById('desc_box').innerHTML = 'Turn surroundings into base element costs.';
        }
    &lt;/script&gt;
    &lt;?php
    }
else
    {
    ?&gt;
    &lt;script type="text/javascript"&gt;
    function setdescription_1()
        {
        document.getElementById('title_box').innerHTML = 'Master Alchemist';
        document.getElementById('desc_box').innerHTML = 'Equiped Philosopher&amp;#39;s Stone allows bypass of element costs.';
        }
    &lt;/script&gt;
    &lt;?php
    }
$sql="SELECT _2 FROM Player_Registry WHERE Player_Name = $_SESSION[user_name]";
$result_2=mysql_query($sql);
if($result_2 &lt; 10)
    {
    ?&gt;
    &lt;script type="text/javascript"&gt;
    function setdescription_2()
        {
        document.getElementById('title_box').innerHTML = 'Learn Runes';
        document.getElementById('desc_box').innerHTML = 'Create Runes and Cores up to Lv.&lt;?php echo "$result_2" ?&gt;';
        }
    &lt;/script&gt;
    &lt;?php
    }
else
    {
    ?&gt;
    &lt;script type="text/javascript"&gt;
    function setdescription_2()
        {
        document.getElementById('title_box').innerHTML = 'Comprehension';
        document.getElementById('desc_box').innerHTML = 'Create Runes and Cores up to Lv.10';
        }
    &lt;/script&gt;
    &lt;?php
    }
?&gt;
    &lt;script type="text/javascript"&gt;
    function cleardescription()
        {
        document.getElementById('title_box').innerHTML = 'Skill Name';
        document.getElementById('desc_box').innerHTML = 'This is the skill description.';
        }
    &lt;/script&gt;
    &lt;table&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;/td&gt;
            &lt;td&gt;&lt;a href='AddSkillPoints.php?skill=_1' onmouseover="setdescription_1()" onmouseout="cleardescription()"&gt;&lt;img src="Alchemist.png" /&gt;&lt;/a&gt;&lt;/td&gt;
            &lt;td&gt;&lt;img src="Blank_Tile.png"/&gt;&lt;/td&gt;
            &lt;td&gt;&lt;a href='AddSkillPoints.php?skill=_2' onmouseover="setdescription_2()" onmouseout="cleardescription()"&gt;&lt;img src="Learn_Runes.png"/&gt;&lt;/td&gt;

etc..............

    &lt;/table&gt;
    &lt;/div&gt;
    &lt;div style="width:100%; height:12.5%;"&gt;
        &lt;b&gt;&lt;p id="title_box" style="font-size: 150%;"&gt;Skill Name&lt;/p&gt;&lt;/b&gt;&lt;br /&gt;
        &lt;p id="desc_box"&gt;This is the skill description.&lt;/p&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
