Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7702729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:17:36+00:00 2026-05-31T23:17:36+00:00

basically I want php to decide which version of the site pieces to load

  • 0

basically I want php to decide which version of the site pieces to load
something along the lines of:

    <?php 

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

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

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):

<head>

<title>Blank</title>

<link rel="icon" type="image/png" href="Pictures/favicon.png">

<meta name="description" content="" />

<meta name="keywords" content="" />

<meta name="author" content="" />

<meta name="owner" content="" />

<meta name="copyright" content="" />

<meta http-equiv="content-type" content="text/html;charset=UTF-8" />

<link rel="stylesheet" href="TreeStyle.css" type="text/css" />
</head>

<body>


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

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

    </table>
    </div>
    <div style="width:100%; height:12.5%;">
        <b><p id="title_box" style="font-size: 150%;">Skill Name</p></b><br />
        <p id="desc_box">This is the skill description.</p>
    </div>
</div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:17:37+00:00Added an answer on May 31, 2026 at 11:17 pm

    I do not believe you get both if your PHP is actually parsed.
    If it is not parsed, you will see the code you pasted exactly as you pasted it if you look at the source of the web page

    Make sure the php is parsed – if not, then that is the issue.

    A script tag will generally not interfere with parsing unless you have to post processing that does not allow the tags – for example if you use some kind of framework where you are not supposed to enter php but instead some tokenised code

    Here is a better example – note I moved the script to the head but did not optimise really – so the php can be more elegant if you get both values in one call and create an object array

    <?PHP
        $sql="SELECT _1 FROM Player_Registry WHERE Player_Name = $_SESSION[user_name]";
        $result_1=mysql_query($sql);
        $sql="SELECT _2 FROM Player_Registry WHERE Player_Name = $_SESSION[user_name]";
        $result_2=mysql_query($sql);
    %><html>
        <head>
        <title>Blank</title>
        <link rel="icon" type="image/png" href="Pictures/favicon.png">
    .
    .
        <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
        <link rel="stylesheet" href="TreeStyle.css" type="text/css" />
        <script type="text/javascript">
        var result1 = parseInt("<?PHP echo $result_1; ">,10);
        var skillLevel = (result1>=10?'Master ':'')+'Alchemist';
        var skillDesc  = result1>=10?"Equipped with Philosopher´s Stone allows bypass of element costs.":"Turn surroundings into base element costs.";
    
        var runeLevel  = result2>=10?'Comprehension':'Learn Runes';
        var runeDesc   = 'Create Runes and Cores up to Lv.'+result2; 
    
        window.onload=function() {
          setdescription_1();
        }
        function setdescription_1() {
              document.getElementById('title_box').innerHTML = skillLevel;
              document.getElementById('desc_box').innerHTML =  skillDesc; 
        }         
        function setdescription_2() {
              document.getElementById('title_box').innerHTML = runeLevel;
              document.getElementById('desc_box').innerHTML =  runeDesc; 
            }
        function cleardescription() {
                document.getElementById('title_box').innerHTML = 'Skill Name';
                document.getElementById('desc_box').innerHTML = 'This is the skill description.';
        }
            </script>
    
    
    
        </head>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I have a single page on my site that I want any php
I have a php site, which is basically like a site directory, what I
I basically want the same functionality of preg_match_all() from PHP in a Python way.
I am building an AJAX deep-linked site. I want PHP to load all the
I am new with cron job in php,basically i want to send email to
What i basically want to do is to get content from a website and
Basically I want to write php code that lists all the contents that are
I basically want to use the XML parser from Qt in my existing project.
I basically want each request to http://localhost/~lucamatteis/datadict/AccessionMainName to actually call http://localhost/~lucamatteis/datadict/index.php/AccessionMainName Here's my current
I basically want to rewrite any request starting with foo/ to foo/index.php?url= . For

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.